iteratee-0.2.3: Iteratee-based I/OSource codeContentsIndex
Data.Iteratee.Char
Contents
Type synonyms
Word and Line processors
Description
Utilties for Char-based iteratee processing.
Synopsis
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 :: (Functor m, Monad m) => IterateeG [] Line m a -> IterateeG [] Char m (IterateeG [] Line m a)
enumWords :: (Functor m, Monad m) => IterateeG [] String m a -> IterateeG [] Char m (IterateeG [] String 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 Iteratee = IterateeG [] CharSource
type EnumeratorM m a = EnumeratorGM [] Char m aSource
type Line = StringSource
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 :: (Functor m, Monad m) => IterateeG [] Line m a -> IterateeG [] Char m (IterateeG [] Line 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 :: (Functor m, Monad m) => IterateeG [] String m a -> IterateeG [] Char m (IterateeG [] String 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
Produced by Haddock version 2.6.0