megaparsec-9.2.1: Monadic parser combinators
Copyright © 2015–present Megaparsec contributors
License FreeBSD
Maintainer Mark Karpov <markkarpov92@gmail.com>
Stability experimental
Portability portable
Safe Haskell Safe
Language Haskell2010

Text.Megaparsec.Error.Builder

Description

A set of helpers that should make construction of ParseError s more concise. This is primarily useful in test suites and for debugging.

Since: 6.0.0

Synopsis

Top-level helpers

err Source #

Arguments

:: Int

ParseError offset

-> ET s

Error components

-> ParseError s e

Resulting ParseError

Assemble a ParseError from the offset and the ET t value. ET t is a monoid and can be assembled by combining primitives provided by this module, see below.

errFancy Source #

Arguments

:: Int

ParseError offset

-> EF e

Error components

-> ParseError s e

Resulting ParseError

Like err , but constructs a “fancy” ParseError .

Error components

utok :: Stream s => Token s -> ET s Source #

Construct an “unexpected token” error component.

utoks :: forall s. Stream s => Tokens s -> ET s Source #

Construct an “unexpected tokens” error component. Empty chunk produces EndOfInput .

ulabel :: Stream s => String -> ET s Source #

Construct an “unexpected label” error component. Do not use with empty strings (for empty strings it's bottom).

ueof :: Stream s => ET s Source #

Construct an “unexpected end of input” error component.

etok :: Stream s => Token s -> ET s Source #

Construct an “expected token” error component.

etoks :: forall s. Stream s => Tokens s -> ET s Source #

Construct an “expected tokens” error component. Empty chunk produces EndOfInput .

elabel :: Stream s => String -> ET s Source #

Construct an “expected label” error component. Do not use with empty strings.

eeof :: Stream s => ET s Source #

Construct an “expected end of input” error component.

fancy :: ErrorFancy e -> EF e Source #

Construct a custom error component.

Data types

data ET s Source #

Auxiliary type for construction of trivial parse errors.

Instances

Instances details
Eq ( Token s) => Eq ( ET s) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

( Data s, Data ( Token s), Ord ( Token s)) => Data ( ET s) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> ET s -> c ( ET s) Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ( ET s) Source #

toConstr :: ET s -> Constr Source #

dataTypeOf :: ET s -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ( ET s)) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ( ET s)) Source #

gmapT :: ( forall b. Data b => b -> b) -> ET s -> ET s Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> ET s -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> ET s -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> ET s -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> ET s -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> ET s -> m ( ET s) Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> ET s -> m ( ET s) Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> ET s -> m ( ET s) Source #

Ord ( Token s) => Ord ( ET s) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

Generic ( ET s) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

Associated Types

type Rep ( ET s) :: Type -> Type Source #

Stream s => Semigroup ( ET s) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

Stream s => Monoid ( ET s) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

type Rep ( ET s) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

data EF e Source #

Auxiliary type for construction of fancy parse errors.

Instances

Instances details
Eq e => Eq ( EF e) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

( Data e, Ord e) => Data ( EF e) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> EF e -> c ( EF e) Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ( EF e) Source #

toConstr :: EF e -> Constr Source #

dataTypeOf :: EF e -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ( EF e)) Source #

dataCast2 :: Typeable t => ( forall d e0. ( Data d, Data e0) => c (t d e0)) -> Maybe (c ( EF e)) Source #

gmapT :: ( forall b. Data b => b -> b) -> EF e -> EF e Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> EF e -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> EF e -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> EF e -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> EF e -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> EF e -> m ( EF e) Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> EF e -> m ( EF e) Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> EF e -> m ( EF e) Source #

Ord e => Ord ( EF e) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

Generic ( EF e) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

Associated Types

type Rep ( EF e) :: Type -> Type Source #

Ord e => Semigroup ( EF e) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

Ord e => Monoid ( EF e) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

type Rep ( EF e) Source #
Instance details

Defined in Text.Megaparsec.Error.Builder

type Rep ( EF e) = D1 (' MetaData "EF" "Text.Megaparsec.Error.Builder" "megaparsec-9.2.1-EI4cRL0SAfYAOxBOfPeCV9" ' True ) ( C1 (' MetaCons "EF" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 ( Set ( ErrorFancy e)))))