Utilties for Char-based iteratee processing.
- type Stream = StreamG [] Char
- type Iteratee = IterateeG [] Char
- type EnumeratorM m a = EnumeratorGM [] Char m a
- type Line = String
- line :: Monad m => IterateeG [] Char m (Either Line Line)
- printLines :: IterateeG [] Char IO ()
- readLines :: Monad m => IterateeG [] Char m (Either [Line] [Line])
- enumLines :: (ListLike (s el) el, StringLike (s el), Functor m, Monad m) => IterateeG [] (s el) m a -> IterateeG s el m (IterateeG [] (s el) m a)
- enumWords :: (ListLike (s el) el, StringLike (s el), Functor m, Monad m) => IterateeG [] (s el) m a -> IterateeG s el m (IterateeG [] (s el) m a)
- module Data.Iteratee.Base
Type synonyms
type Stream = StreamG [] CharSource
A particular instance of StreamG: the stream of characters. This stream is used by many input parsers.
type EnumeratorM m a = EnumeratorGM [] Char m aSource
Word and Line processors
line :: Monad m => IterateeG [] Char m (Either Line Line)Source
Read the line of text from the stream The line can be terminated by CR, LF or CRLF. Return (Right Line) if successful. Return (Left Line) if EOF or a stream error were encountered before the terminator is seen. The returned line is the string read so far.
printLines :: IterateeG [] Char IO ()Source
Print lines as they are received. This is the first impure
iteratee
with non-trivial actions during chunk processing
readLines :: Monad m => IterateeG [] Char m (Either [Line] [Line])Source
Read a sequence of lines from the stream up to the empty lin The line can be terminated by CR, LF, or CRLF -- or by EOF or stream error. Return the read lines, in order, not including the terminating empty line Upon EOF or stream error, return the complete, terminated lines accumulated so far.
enumLines :: (ListLike (s el) el, StringLike (s el), Functor m, Monad m) => IterateeG [] (s el) m a -> IterateeG s el m (IterateeG [] (s el) m a)Source
Convert the stream of characters to the stream of lines, and apply the given iteratee to enumerate the latter. The stream of lines is normally terminated by the empty line. When the stream of characters is terminated, the stream of lines is also terminated, abnormally. This is the first proper iteratee-enumerator: it is the iteratee of the character stream and the enumerator of the line stream.
enumWords :: (ListLike (s el) el, StringLike (s el), Functor m, Monad m) => IterateeG [] (s el) m a -> IterateeG s el m (IterateeG [] (s el) m a)Source
Convert the stream of characters to the stream of words, and apply the given iteratee to enumerate the latter. Words are delimited by white space. This is the analogue of List.words One should keep in mind that enumWords is a more general, monadic function.
module Data.Iteratee.Base