headed-megaparsec-0.1.0.3: More informative parser

Safe HaskellNone
LanguageHaskell2010

HeadedMegaparsec.TrailingParsec

Contents

Synopsis

Documentation

data TrailingParsec err strm a Source #

Accumulates the sequently composed alternatives, alternating between all combinations when executed.

Instances
(Ord err, Stream strm) => Monad (TrailingParsec err strm) Source # 
Instance details

Defined in HeadedMegaparsec.TrailingParsec

Methods

(>>=) :: TrailingParsec err strm a -> (a -> TrailingParsec err strm b) -> TrailingParsec err strm b #

(>>) :: TrailingParsec err strm a -> TrailingParsec err strm b -> TrailingParsec err strm b #

return :: a -> TrailingParsec err strm a #

fail :: String -> TrailingParsec err strm a #

Functor (TrailingParsec err strm) Source # 
Instance details

Defined in HeadedMegaparsec.TrailingParsec

Methods

fmap :: (a -> b) -> TrailingParsec err strm a -> TrailingParsec err strm b #

(<$) :: a -> TrailingParsec err strm b -> TrailingParsec err strm a #

(Ord err, Stream strm) => MonadFail (TrailingParsec err strm) Source # 
Instance details

Defined in HeadedMegaparsec.TrailingParsec

Methods

fail :: String -> TrailingParsec err strm a #

(Ord err, Stream strm) => Applicative (TrailingParsec err strm) Source # 
Instance details

Defined in HeadedMegaparsec.TrailingParsec

Methods

pure :: a -> TrailingParsec err strm a #

(<*>) :: TrailingParsec err strm (a -> b) -> TrailingParsec err strm a -> TrailingParsec err strm b #

liftA2 :: (a -> b -> c) -> TrailingParsec err strm a -> TrailingParsec err strm b -> TrailingParsec err strm c #

(*>) :: TrailingParsec err strm a -> TrailingParsec err strm b -> TrailingParsec err strm b #

(<*) :: TrailingParsec err strm a -> TrailingParsec err strm b -> TrailingParsec err strm a #

(Ord err, Stream strm) => Alternative (TrailingParsec err strm) Source # 
Instance details

Defined in HeadedMegaparsec.TrailingParsec

Methods

empty :: TrailingParsec err strm a #

(<|>) :: TrailingParsec err strm a -> TrailingParsec err strm a -> TrailingParsec err strm a #

some :: TrailingParsec err strm a -> TrailingParsec err strm [a] #

many :: TrailingParsec err strm a -> TrailingParsec err strm [a] #

(Ord err, Stream strm) => MonadPlus (TrailingParsec err strm) Source # 
Instance details

Defined in HeadedMegaparsec.TrailingParsec

Methods

mzero :: TrailingParsec err strm a #

mplus :: TrailingParsec err strm a -> TrailingParsec err strm a -> TrailingParsec err strm a #

(Ord err, Stream strm) => Selective (TrailingParsec err strm) Source # 
Instance details

Defined in HeadedMegaparsec.TrailingParsec

Methods

select :: TrailingParsec err strm (Either a b) -> TrailingParsec err strm (a -> b) -> TrailingParsec err strm b #

Execution

toHeadedParsec :: (Ord err, Stream strm) => TrailingParsec err strm a -> HeadedParsec err strm a Source #

toParsec :: (Ord err, Stream strm) => TrailingParsec err strm a -> Parsec err strm a Source #

Transformation

label :: (Ord err, Stream strm) => String -> TrailingParsec err strm a -> TrailingParsec err strm a Source #

Label a headed parser. Works the same way as megaparsec's label.

dbg :: (Ord err, ShowErrorComponent err, Stream strm, Show a) => String -> TrailingParsec err strm a -> TrailingParsec err strm a Source #

Make a parser print debugging information when evaluated. The first parameter is a custom label.

This function is a wrapper around dbg. It generates two debugging entries: one for head and one for tail.

filter :: (Ord err, Stream strm) => (a -> String) -> (a -> Bool) -> TrailingParsec err strm a -> TrailingParsec err strm a Source #

Filter the results of parser based on a predicate, failing with a parameterized message.

Construction

parse :: (Ord err, Stream strm) => Parsec err strm a -> TrailingParsec err strm a Source #

Lift a megaparsec parser.

parseHeaded :: (Ord err, Stream strm) => HeadedParsec err strm a -> TrailingParsec err strm a Source #

Lift a headed parser.

endHead :: Stream strm => TrailingParsec err strm () Source #

Make all the following parsers compose as tail.