| 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 :: Type -> Type) a
- runConduitParser :: forall (m :: Type -> Type) i a. MonadThrow m => ConduitParser i m a -> ConduitT i Void m a
- named :: forall (m :: Type -> Type) i a. Monad m => Text -> ConduitParser i m a -> ConduitParser i m a
- await :: forall (m :: Type -> Type) i. Monad m => ConduitParser i m i
- leftover :: forall i (m :: Type -> Type). i -> ConduitParser i m ()
- getParserNames :: forall i (m :: Type -> Type). ConduitParser i m [Text]
- getParserName :: forall i (m :: Type -> Type). ConduitParser i m Text
- peek :: forall (m :: Type -> Type) i. Monad m => ConduitParser i m (Maybe i)
- data ConduitParserException
Conduit parser monad
data ConduitParser i (m :: Type -> Type) a #
Core type of the package. This is basically a Sink with a parsing state.
Instances
runConduitParser :: forall (m :: Type -> Type) i a. MonadThrow m => ConduitParser i m a -> ConduitT i Void m a #
Run a ConduitParser.
Any parsing failure will be thrown as an exception.
named :: forall (m :: Type -> Type) i a. Monad m => Text -> ConduitParser i m a -> ConduitParser i m a #
Flipped version of (<?>).
Primitives
await :: forall (m :: Type -> Type) i. Monad m => ConduitParser i m i #
await wrapped as a ConduitParser.
If no data is available, UnexpectedEndOfInput is thrown.
leftover :: forall i (m :: Type -> Type). i -> ConduitParser i m () #
leftover wrapped as a ConduitParser.
getParserNames :: forall i (m :: Type -> Type). ConduitParser i m [Text] #
Return the ordered list of names (assigned through (<?>)) for the current parser stack. First element is the most nested parser.
getParserName :: forall i (m :: Type -> Type). ConduitParser i m Text #
Utility
peek :: forall (m :: Type -> Type) i. Monad m => ConduitParser i m (Maybe i) #
peek wrapped as a ConduitParser.
Exception
data ConduitParserException #
Constructors
| BothFailed ConduitParserException ConduitParserException | |
| ExpectedEndOfInput | |
| NamedParserException Text ConduitParserException | |
| UnexpectedEndOfInput | |
| UnexpectedFollowedBy Text | |
| Unexpected Text |