Cabal-syntax-3.8.1.0: A library for working with .cabal files
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.Fields.ParseResult

Description

A parse result type for parsers from AST to Haskell types.

Synopsis

Documentation

data ParseResult a Source #

A monad with failure and accumulating errors and warnings.

Instances

Instances details
Applicative ParseResult Source # 
Instance details

Defined in Distribution.Fields.ParseResult

Functor ParseResult Source # 
Instance details

Defined in Distribution.Fields.ParseResult

Methods

fmap :: (a -> b) -> ParseResult a -> ParseResult b Source #

(<$) :: a -> ParseResult b -> ParseResult a Source #

Monad ParseResult Source # 
Instance details

Defined in Distribution.Fields.ParseResult

runParseResult :: ParseResult a -> ([PWarning], Either (Maybe Version, NonEmpty PError) a) Source #

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 Source #

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 () Source #

Add a warning. This doesn't fail the parsing process.

parseWarnings :: [PWarning] -> ParseResult () Source #

Add multiple warnings at once.

parseFailure :: Position -> String -> ParseResult () Source #

Add an error, but not fail the parser yet.

For fatal failure use parseFatalFailure

parseFatalFailure :: Position -> String -> ParseResult a Source #

Add an fatal error.

getCabalSpecVersion :: ParseResult (Maybe Version) Source #

Get cabal spec version.

setCabalSpecVersion :: Maybe Version -> ParseResult () Source #

Set cabal spec version.

withoutWarnings :: ParseResult a -> ParseResult a Source #

Forget ParseResults warnings.

Since: Cabal-syntax-3.4.0.0