Portability | portable |
---|---|
Maintainer | jmillikin@gmail.com |
This module is intended to be imported qualified:
import qualified Data.Enumerator.Text as ET
Since: 0.2
- enumHandle :: MonadIO m => Handle -> Enumerator Text m b
- enumFile :: FilePath -> Enumerator Text IO b
- iterHandle :: MonadIO m => Handle -> Iteratee Text m ()
- head :: Monad m => Iteratee Text m (Maybe Char)
- drop :: Monad m => Integer -> Iteratee Text m ()
- dropWhile :: Monad m => (Char -> Bool) -> Iteratee Text m ()
- take :: Monad m => Integer -> Iteratee Text m Text
- takeWhile :: Monad m => (Char -> Bool) -> Iteratee Text m Text
- consume :: Monad m => Iteratee Text m Text
- require :: Monad m => Integer -> Iteratee Text m ()
- isolate :: Monad m => Integer -> Enumeratee Text Text m b
- data Codec
- encode :: Monad m => Codec -> Enumeratee Text ByteString m b
- decode :: Monad m => Codec -> Enumeratee ByteString Text m b
- utf8 :: Codec
- utf16_le :: Codec
- utf16_be :: Codec
- utf32_le :: Codec
- utf32_be :: Codec
- ascii :: Codec
- iso8859_1 :: Codec
Text IO
enumHandle :: MonadIO m => Handle -> Enumerator Text m bSource
Read lines of text from the handle, and stream them to an Iteratee
.
If an exception occurs during file IO, enumeration will stop and Error
will be returned. Exceptions from the iteratee are not caught.
The handle should be opened with an appropriate text encoding, and
in ReadMode
or ReadWriteMode
.
Since: 0.2
enumFile :: FilePath -> Enumerator Text IO bSource
Opens a file path in text mode, and passes the handle to enumHandle
.
The file will be closed when the Iteratee
finishes.
Since: 0.2
iterHandle :: MonadIO m => Handle -> Iteratee Text m ()Source
Read text from a stream and write it to a handle. If an exception
occurs during file IO, enumeration will stop and Error
will be
returned.
The handle should be opened with an appropriate text encoding, and
in WriteMode
or ReadWriteMode
.
Since: 0.2
List analogues
head :: Monad m => Iteratee Text m (Maybe Char)Source
Get the next character from the stream, or Nothing
if the stream has
ended.
Since: 0.4.5
drop :: Monad m => Integer -> Iteratee Text m ()Source
drop n
ignores n characters of input from the stream.
Since: 0.4.5
dropWhile :: Monad m => (Char -> Bool) -> Iteratee Text m ()Source
dropWhile p
ignores input from the stream until the first character
which does not match the predicate.
Since: 0.4.5
take :: Monad m => Integer -> Iteratee Text m TextSource
take n
extracts the next n characters from the stream, as a lazy
Text.
Since: 0.4.5
takeWhile :: Monad m => (Char -> Bool) -> Iteratee Text m TextSource
takeWhile p
extracts input from the stream until the first character
which does not match the predicate.
Since: 0.4.5
consume :: Monad m => Iteratee Text m TextSource
Read all remaining input from the stream, and return as a lazy Text.
Since: 0.4.5
require :: Monad m => Integer -> Iteratee Text m ()Source
require n
buffers input until at least n characters are available,
or throws an error if the stream ends early.
Since: 0.4.5
isolate :: Monad m => Integer -> Enumeratee Text Text m bSource
isolate n
reads at most n characters from the stream, and passes
them to its iteratee. If the iteratee finishes early, characters continue
to be consumed from the outer stream until n have been consumed.
Since: 0.4.5
Codecs
encode :: Monad m => Codec -> Enumeratee Text ByteString m bSource
Convert text into bytes, using the provided codec. If the codec is not capable of representing an input character, an error will be thrown.
Since: 0.2
decode :: Monad m => Codec -> Enumeratee ByteString Text m bSource
Convert bytes into text, using the provided codec. If the codec is not capable of decoding an input byte sequence, an error will be thrown.
Since: 0.2