Header menu logo XParsec

ParseError Module

Helpers for constructing and inspecting ParseError{T,S} values. Also exposes the canonical Message values used by the standard combinators (`shouldConsume`, `bothFailed`, etc.) so user code can pattern-match against them and produce the same error shape.

Functions and values

Function or value Description

allChoicesFailed

Full Usage: allChoicesFailed

Returns: ErrorType<'a, 'b>

Wraps the per-branch errors from `choice` when every alternative failed.

Returns: ErrorType<'a, 'b>

bothFailed

Full Usage: bothFailed

Returns: ErrorType<'a, 'b>

Wraps the two errors from `<|>` (or the loop-stuck pair from `manyTill`) when both sides failed.

Returns: ErrorType<'a, 'b>

create error position

Full Usage: create error position

Parameters:
Returns: ParseResult<'Parsed, 'T, 'State>
Modifiers: inline
Type parameters: 'T, 'State, 'Parsed

Constructs a Result.Error at the given position from the supplied error type.

error : ErrorType<'T, 'State>
position : Position<'State>
Returns: ParseResult<'Parsed, 'T, 'State>

createNested error children position

Full Usage: createNested error children position

Parameters:
Returns: ParseResult<'Parsed, 'T, 'State>
Modifiers: inline
Type parameters: 'T, 'State, 'Parsed

Constructs a Result.Error with a `Nested(parent, children)` body at the given position.

error : ErrorType<'T, 'State>
children : ParseError<'T, 'State> list
position : Position<'State>
Returns: ParseResult<'Parsed, 'T, 'State>

empty position

Full Usage: empty position

Parameters:
Returns: ParseError<'T, 'State>
Modifiers: inline
Type parameters: 'State, 'T

An "unspecified" error at the given position. Used as a sentinel by internal soft-error accumulators where every code path needs a `ParseError` value but most are "no error here yet".

position : Position<'State>
Returns: ParseError<'T, 'State>

expectedAtLeastOne

Full Usage: expectedAtLeastOne

Returns: ErrorType<'a, 'b>

Used by `many1`, `sepBy1`, `fold1`, etc. when the first item fails.

Returns: ErrorType<'a, 'b>

expectedEnd

Full Usage: expectedEnd

Returns: ErrorType<'a, 'b>

Used by `eof` when there are still items left in the input.

Returns: ErrorType<'a, 'b>

isEmpty e

Full Usage: isEmpty e

Parameters:
Returns: bool
Modifiers: inline
Type parameters: 'T, 'State

True if the given error carries no specific information (`Empty`). Used by aggregating combinators to filter out `pzero`-style siblings before nesting.

e : ErrorType<'T, 'State>
Returns: bool

shouldConsume

Full Usage: shouldConsume

Returns: ErrorType<'a, 'b>

Used by `notEmpty` when its inner parser returned `Ok` without advancing.

Returns: ErrorType<'a, 'b>

shouldFailInPlace

Full Usage: shouldFailInPlace

Returns: ErrorType<'a, 'b>

Used by `notFollowedBy` when the inner parser failed but had already consumed input.

Returns: ErrorType<'a, 'b>

shouldNotConsume

Full Usage: shouldNotConsume

Returns: ErrorType<'a, 'b>

Used by `followedBy*` when its inner parser advanced (it should have peeked, not consumed).

Returns: ErrorType<'a, 'b>

shouldNotSucceed

Full Usage: shouldNotSucceed

Returns: ErrorType<'a, 'b>

Used by `notFollowedBy` when the inner parser unexpectedly succeeded.

Returns: ErrorType<'a, 'b>

unexpectedEnd

Full Usage: unexpectedEnd

Returns: ErrorType<'a, 'b>

Generic "we hit EOF" message used in error-formatting fallbacks.

Returns: ErrorType<'a, 'b>

wrongUserState

Full Usage: wrongUserState

Returns: ErrorType<'a, 'b>

Used by `userStateSatisfies` when the predicate rejects the current state.

Returns: ErrorType<'a, 'b>

zero

Full Usage: zero

Returns: ErrorType<'a, 'b>

Unspecified failure — emitted by `pzero`. Aggregating combinators drop these from nested children; the default formatter renders nothing for them.

Returns: ErrorType<'a, 'b>

Type something to start searching.