Safe Haskell  None 

The utilities in this module allow you to run Attoparsec parsers on input flowing downstream through pipes, possibly interleaving other stream effects while doing so.
This module builds on top of the attoparsec
, pipes
and pipesparse
libraries and assumes you understand how to use those.
 parse :: (Monad m, ParserInput a) => Parser a b > StateT (Producer a m r) m (Either ParsingError (Int, b))
 parseMany :: (Monad m, ParserInput a) => Parser a b > Producer a m r > Producer' (Int, b) m (Either (ParsingError, Producer a m r) r)
 isEndOfParserInput :: (ParserInput a, Monad m) => StateT (Producer a m r) m Bool
 class (Eq a, Monoid a) => ParserInput a
 data ParsingError = ParsingError {
 peContexts :: [String]
 peMessage :: String
Parsing
:: (Monad m, ParserInput a)  
=> Parser a b  Attoparsec parser. 
> StateT (Producer a m r) m (Either ParsingError (Int, b)) 
Run an Attoparsec Parser
on input from the underlying Producer
,
returning either a ParsingError
on failure, or a pair with the parsed
entity together with the length of input consumed in order to produce it.
Use this function only if isEndOfParserInput
returns False
, otherwise
you'll get unexpected parsing errors.
:: (Monad m, ParserInput a)  
=> Parser a b  Attoparsec parser. 
> Producer a m r  Producer from which to draw input. 
> Producer' (Int, b) m (Either (ParsingError, Producer a m r) r) 
Continuously run an Attoparsec Parser
on input from the given Producer
,
sending downstream pairs of each successfully parsed entity together with the
length of input consumed in order to produce it.
This Producer
runs until it either runs out of input or a parsing
failure occurs, in which case it returns Left
with a ParsingError
and a
Producer
with any leftovers. You can use errorP
to turn the Either
return value into an ErrorT
monad transformer.
isEndOfParserInput :: (ParserInput a, Monad m) => StateT (Producer a m r) m BoolSource
Like isEndOfInput
, except it also consumes and discards leading
empty ParserInput
chunks.
Types
class (Eq a, Monoid a) => ParserInput a Source
A class for valid Attoparsec input types: strict Text
and
strict ByteString
.
data ParsingError Source
A parsing error report, as provided by Attoparsec's Fail
.
ParsingError  
