Portability | portable |
---|---|
Maintainer | jmillikin@gmail.com |
Enumerator-based text IO
- enumHandle :: MonadIO m => Handle -> Enumerator Text m b
- enumFile :: FilePath -> Enumerator Text IO b
- iterHandle :: MonadIO m => Handle -> Iteratee Text m ()
- 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
Enumerators and iteratees
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
.
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.
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
.
Codecs
encode :: Monad m => Codec -> Enumeratee Text ByteString m bSource
decode :: Monad m => Codec -> Enumeratee ByteString Text m bSource