Safe Haskell | None |
---|---|
Language | Haskell2010 |
A parse result type for parsers from AST to Haskell types.
- data ParseResult a
- runParseResult :: ParseResult a -> ([PWarning], Either (Maybe Version, [PError]) a)
- recoverWith :: ParseResult a -> a -> ParseResult a
- parseWarning :: Position -> PWarnType -> String -> ParseResult ()
- parseWarnings :: [PWarning] -> ParseResult ()
- parseFailure :: Position -> String -> ParseResult ()
- parseFatalFailure :: Position -> String -> ParseResult a
- parseFatalFailure' :: ParseResult a
- getCabalSpecVersion :: ParseResult (Maybe Version)
- setCabalSpecVersion :: Maybe Version -> ParseResult ()
Documentation
data ParseResult a #
A monad with failure and accumulating errors and warnings.
runParseResult :: ParseResult a -> ([PWarning], Either (Maybe Version, [PError]) a) #
Destruct a ParseResult
into the emitted warnings and either
a successful value or
list of errors and possibly recovered a spec-version declaration.
recoverWith :: ParseResult a -> a -> ParseResult a #
Recover the parse result, so we can proceed parsing.
runParseResult
will still result in Nothing
, if there are recorded errors.
parseWarning :: Position -> PWarnType -> String -> ParseResult () #
Add a warning. This doesn't fail the parsing process.
parseWarnings :: [PWarning] -> ParseResult () #
Add multiple warnings at once.
parseFailure :: Position -> String -> ParseResult () #
Add an error, but not fail the parser yet.
For fatal failure use parseFatalFailure
parseFatalFailure :: Position -> String -> ParseResult a #
Add an fatal error.
parseFatalFailure' :: ParseResult a #
A mzero
.
getCabalSpecVersion :: ParseResult (Maybe Version) #
Get cabal spec version.
setCabalSpecVersion :: Maybe Version -> ParseResult () #
Set cabal spec version.