Safe Haskell | None |
---|
Consume attoparsec parsers via conduit.
This code was taken from attoparsec-enumerator and adapted for conduits.
- sinkParser :: (AttoparsecInput a, MonadThrow m) => Parser a b -> GLSink a m b
- conduitParser :: (AttoparsecInput a, MonadThrow m) => Parser a b -> GLInfConduit a m (PositionRange, b)
- data ParseError
- = ParseError { }
- | DivergentParser
- data Position = Position {}
- data PositionRange = PositionRange {}
- class AttoparsecInput a
Sink
sinkParser :: (AttoparsecInput a, MonadThrow m) => Parser a b -> GLSink a m bSource
Convert an Attoparsec Parser
into a Sink
. The parser will
be streamed bytes until it returns Done
or Fail
.
If parsing fails, a ParseError
will be thrown with monadThrow
.
Since 0.5.0
Conduit
conduitParser :: (AttoparsecInput a, MonadThrow m) => Parser a b -> GLInfConduit a m (PositionRange, b)Source
Consume a stream of parsed tokens, returning both the token and the position it appears at.
Since 0.5.0
Types
data ParseError Source
The context and message from a Fail
value.
data PositionRange Source
Classes
class AttoparsecInput a Source
A class of types which may be consumed by an Attoparsec parser.