Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data.Conduit.Parser
Description
This module introduces ConduitParser
, a wrapper around Sink
that behaves like a parser.
You probably want to import the Text.Parser.Combinators module together with this module.
Synopsis
- data ConduitParser i m a
- runConduitParser :: MonadThrow m => ConduitParser i m a -> ConduitT i Void m a
- named :: Monad m => Text -> ConduitParser i m a -> ConduitParser i m a
- await :: Monad m => ConduitParser i m i
- leftover :: i -> ConduitParser i m ()
- getParserNames :: ConduitParser i m [Text]
- getParserName :: ConduitParser i m Text
- peek :: Monad m => ConduitParser i m (Maybe i)
- data ConduitParserException
Conduit parser monad
data ConduitParser i m a Source #
Core type of the package. This is basically a Sink
with a parsing state.
Instances
runConduitParser :: MonadThrow m => ConduitParser i m a -> ConduitT i Void m a Source #
Run a ConduitParser
.
Any parsing failure will be thrown as an exception.
named :: Monad m => Text -> ConduitParser i m a -> ConduitParser i m a Source #
Flipped version of (<?>
).
Primitives
await :: Monad m => ConduitParser i m i Source #
await
wrapped as a ConduitParser
.
If no data is available, UnexpectedEndOfInput
is thrown.
leftover :: i -> ConduitParser i m () Source #
leftover
wrapped as a ConduitParser
.
getParserNames :: ConduitParser i m [Text] Source #
Return the ordered list of names (assigned through (<?>
)) for the current parser stack. First element is the most nested parser.
getParserName :: ConduitParser i m Text Source #
Utility
peek :: Monad m => ConduitParser i m (Maybe i) Source #
peek
wrapped as a ConduitParser
.
Exception
data ConduitParserException Source #
Constructors
BothFailed ConduitParserException ConduitParserException | |
ExpectedEndOfInput | |
NamedParserException Text ConduitParserException | |
UnexpectedEndOfInput | |
UnexpectedFollowedBy Text | |
Unexpected Text |