iterIO-0.2: Iteratee-based IO with pipe operators



This module contains an adapter function to run attoparsec Parsers from within the Iter monad.



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.

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 Right a if the parser succeeds with result a. Returns Left err where err 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.)