iteratee-0.8.9.4: Iteratee-based I/O

Safe Haskell | None

Data.Iteratee.Char

Contents

- Word and Line processors

Description

Utilities for Char-based iteratee processing.

Synopsis

- printLines :: Iteratee String IO ()
- printLinesUnterminated :: forall s el. (Eq el, Nullable s, StringLike s, ListLike s el) => Iteratee s IO ()
- enumLines :: (ListLike s el, StringLike s, Nullable s, Monad m) => Enumeratee s [s] m a
- enumLinesBS :: Monad m => Enumeratee ByteString [ByteString] m a
- enumWords :: (ListLike s Char, Nullable s, Monad m) => Enumeratee s [s] m a
- enumWordsBS :: Monad m => Enumeratee ByteString [ByteString] m a

# Word and Line processors

printLines :: Iteratee String IO ()

Print lines as they are received. This is the first `impure` iteratee with non-trivial actions during chunk processing

Only lines ending with a newline are printed, data terminated with EOF is not printed.

printLinesUnterminated :: forall s el. (Eq el, Nullable s, StringLike s, ListLike s el) => Iteratee s IO ()

Print lines as they are received.

All lines are printed, including a line with a terminating EOF. If the final line is terminated by EOF without a newline, no newline is printed. this function should be used in preference to printLines when possible, as it is more efficient with long lines.

enumLines :: (ListLike s el, StringLike s, Nullable s, Monad m) => Enumeratee s [s] m a

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. This is the first proper iteratee-enumerator: it is the iteratee of the character stream and the enumerator of the line stream.

enumLinesBS :: Monad m => Enumeratee ByteString [ByteString] m a

enumWords :: (ListLike s Char, Nullable s, Monad m) => Enumeratee s [s] m a

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

enumWordsBS :: Monad m => Enumeratee ByteString [ByteString] m a