Safe Haskell | None |
---|---|
Language | GHC2021 |
Oughta
Description
See the package README for a high-level description.
Synopsis
- newtype Output = Output ByteString
- check :: LuaProgram -> Output -> IO Result
- check' :: HasCallStack => LuaProgram -> Output -> IO ()
- data LuaProgram
- addPrefix :: Text -> LuaProgram -> LuaProgram
- plainLuaProgram :: FilePath -> Text -> LuaProgram
- fromLines :: FilePath -> (Text -> Maybe Text) -> Text -> LuaProgram
- fromLineComments :: FilePath -> Text -> Text -> LuaProgram
- data Failure = Failure {
- failureProgress :: Progress
- failureTraceback :: !Traceback
- data Progress = Progress {
- progressLoc :: !Loc
- progressMatches :: Seq Match
- progressRemainder :: !ByteString
- data Success = Success {
- successLoc :: !Loc
- successMatches :: Seq Match
- successRemainder :: !ByteString
- newtype Result = Result (Either Failure Success)
- resultNull :: Result -> Bool
- printResult :: Result -> Text
- data Loc = Loc {}
- data Pos = Pos {}
- data Span = Span {}
Running checks
check :: LuaProgram -> Output -> IO Result Source #
Check some program output against a Oughta Lua program.
check' :: HasCallStack => LuaProgram -> Output -> IO () Source #
Like check
, but throws an exception on failure.
Loading Lua programs
data LuaProgram Source #
Lua program paired with a SourceMap
addPrefix :: Text -> LuaProgram -> LuaProgram Source #
Add a prefix (i.e., prelude).
Bumps all subsequent line numbers
plainLuaProgram :: FilePath -> Text -> LuaProgram Source #
A standalone Lua program
fromLines :: FilePath -> (Text -> Maybe Text) -> Text -> LuaProgram Source #
Extract a Lua program embedded in certain lines of another file
Arguments
:: FilePath | |
-> Text | Start of comment marker, e.g., |
-> Text | Whole file |
-> LuaProgram |
Extract a Lua program embedded in the line comments of another file
Interpreting results
Failure to match a program against some text.
Constructors
Failure | |
Fields
|
Instances
Exception Failure Source # | |
Defined in Oughta.Result Methods toException :: Failure -> SomeException # fromException :: SomeException -> Maybe Failure # displayException :: Failure -> String # | |
Show Failure Source # | |
A sequence of successful matches of API calls against some text
Constructors
Progress | |
Fields
|
The result of matching a program against some text.
Constructors
Success | |
Fields
|
The result of running a Oughta Lua program
resultNull :: Result -> Bool Source #
Does this Rusult
reflect running zero checks?