The type of a trifecta parser
The first four arguments are behavior continuations:
epsilon success: the parser has consumed no input and has a result as well as a possible Err; the position and chunk are unchanged (see pure)
epsilon failure: the parser has consumed no input and is failing with the given Err; the position and chunk are unchanged (see empty)
committed success: the parser has consumed input and is yielding the result, set of expected strings that would have permitted this parse to continue, new position, and residual chunk to the continuation.
committed failure: the parser has consumed input and is failing with a given ErrInfo (user-facing error message)
The remaining two arguments are
the current position
the chunk of input currently under analysis
Parser is an Alternative; trifecta's backtracking behavior encoded as <|> is to behave as the leftmost parser which yields a value (regardless of any input being consumed) or which consumes input and fails. That is, a choice of parsers will only yield an epsilon failure if *all* parsers in the choice do. If that is not the desired behavior, see try, which turns a committed parser failure into an epsilon failure (at the cost of error information).
Instances15Monad, Functor, MonadFail, Applicative, Alternative, MonadPlus, …
Monad ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserFunctor ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserMonadFail ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserApplicative ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserAlternative ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserMonadPlus ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserCharParsing ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserParsing ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserLookAheadParsing ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserTokenParsing ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserDeltaParsing ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserErrable ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserMarkParsing Delta ParserDefined in trifecta-2.1.4 · Text.Trifecta.ParserSemigroup a => Semigroup (Parser a)Defined in trifecta-2.1.4 · Text.Trifecta.Parser(Semigroup a, Monoid a) => Monoid (Parser a)Defined in trifecta-2.1.4 · Text.Trifecta.Parser