Data.IterIO.Atto
Description
- class ChunkData t => IterStrictByteString t where
- fromIterStrictByteString :: Monad m => Iter ByteString m a -> Iter t m a
- atto :: (IterStrictByteString t, Monad m) => Parser a -> Iter t m a
- tryAtto :: (IterStrictByteString t, Monad m) => Parser a -> Iter t m (Either String a)
Documentation
class ChunkData t => IterStrictByteString t whereSource
Class of types whose Iters can be converted to strict
ByteStrings. Basically just strict ByteStrings and lazy
ByteStrings. This class mostly exists so that the atto
function can work with either type of ByteString.
Methods
fromIterStrictByteString :: Monad m => Iter ByteString m a -> Iter t m aSource
atto :: (IterStrictByteString t, Monad m) => Parser a -> Iter t m aSource
Run an attoparsec parser in an Iter monad. Throws an
IterFail exception with constructor IterParseErr if the parse
fails. (This exception can be handled with multiParse and
ifParse.)
tryAtto :: (IterStrictByteString t, Monad m) => Parser a -> Iter t m (Either String a)Source
Try running an attoparsec parser. Returns if the
parser succeeds with result Right aa. Returns where Left errerr
is an error message otherwise. Note that the input stream will be
in an indeterminate state should the parser fail. (If you need to
keep parsing input from some known state, it may be better to use
atto in conjunction with multiParse.)