attoparsec-0.14.4: Fast combinator parsing for bytestrings and text

Copyright | Bryan O'Sullivan 2007-2015
License | BSD3
Maintainer | bos@serpentine.com
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Data.Attoparsec.Internal

Description

Simple, efficient parser combinators, loosely based on the Parsec library.

Synopsis

- compareResults :: (Eq i, Eq r) => IResult i r -> IResult i r -> Maybe Bool
- prompt :: Chunk t => State t -> Pos -> More -> (State t -> Pos -> More -> IResult t r) -> (State t -> Pos -> More -> IResult t r) -> IResult t r
- demandInput :: Chunk t => Parser t ()
- demandInput_ :: Chunk t => Parser t t
- wantInput :: Chunk t => Parser t Bool
- endOfInput :: Chunk t => Parser t ()
- atEnd :: Chunk t => Parser t Bool
- satisfyElem :: Chunk t => (ChunkElem t -> Bool) -> Parser t (ChunkElem t)
- concatReverse :: Monoid m => [m] -> m

# Documentation

compareResults :: (Eq i, Eq r) => IResult i r -> IResult i r -> Maybe Bool #

Compare two `IResult` values for equality.

If both `IResult`s are `Partial`, the result will be `Nothing`, as they are incomplete and hence their equality cannot be known. (This is why there is no `Eq` instance for `IResult`.)

prompt :: Chunk t => State t -> Pos -> More -> (State t -> Pos -> More -> IResult t r) -> (State t -> Pos -> More -> IResult t r) -> IResult t r #

Ask for input. If we receive any, pass the augmented input to a success continuation, otherwise to a failure continuation.

demandInput :: Chunk t => Parser t () #

Immediately demand more input via a `Partial` continuation result.

demandInput_ :: Chunk t => Parser t t #

Immediately demand more input via a `Partial` continuation result. Return the new input.

wantInput :: Chunk t => Parser t Bool #

This parser always succeeds. It returns `True` if any input is available either immediately or on demand, and `False` if the end of all input has been reached.

endOfInput :: Chunk t => Parser t () #

Match only if all input has been consumed.

atEnd :: Chunk t => Parser t Bool #

Return an indication of whether the end of input has been reached.

satisfyElem :: Chunk t => (ChunkElem t -> Bool) -> Parser t (ChunkElem t) #

The parser `satisfyElem p` succeeds for any chunk element for which the predicate `p` returns `True`. Returns the element that is actually parsed.

concatReverse :: Monoid m => [m] -> m #

Concatenate a monoid after reversing its elements. Used to glue together a series of textual chunks that have been accumulated "backwards".