Safe Haskell | None |
---|---|
Language | Haskell2010 |
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.
- 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.
MonadError ConduitParserException (ConduitParser i m) Source # | Backtracking is supported by pushing back consumed elements (using As a consequence, within the scope of a |
MonadTrans (ConduitParser i) Source # | |
Monad (ConduitParser i m) Source # | |
Functor (ConduitParser i m) Source # | |
Applicative (ConduitParser i m) Source # | |
Alternative (ConduitParser i m) Source # | Parsers can be combined with ( The use of |
MonadIO m => MonadIO (ConduitParser i m) Source # | |
MonadThrow m => MonadThrow (ConduitParser i m) Source # | |
Monad m => Parsing (ConduitParser i m) Source # | Parsing combinators can be used with |
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 #
BothFailed ConduitParserException ConduitParserException | |
ExpectedEndOfInput | |
NamedParserException Text ConduitParserException | |
UnexpectedEndOfInput | |
UnexpectedFollowedBy Text | |
Unexpected Text |
Eq ConduitParserException Source # | |
Show ConduitParserException Source # | |
Exception ConduitParserException Source # | |
MonadError ConduitParserException (ConduitParser i m) Source # | Backtracking is supported by pushing back consumed elements (using As a consequence, within the scope of a |