conduit-1.0.17.1: Streaming data processing library.

Safe HaskellNone

Data.Conduit.Text

Contents

Description

Handle streams of text.

Parts of this code were taken from enumerator and adapted for conduits.

Synopsis

Text codecs

data Codec Source

A specific character encoding.

Since 0.3.0

Instances

encode :: MonadThrow m => Codec -> Conduit Text m ByteStringSource

Convert text into bytes, using the provided codec. If the codec is not capable of representing an input character, an exception will be thrown.

Since 0.3.0

decode :: MonadThrow m => Codec -> Conduit ByteString m TextSource

Convert bytes into text, using the provided codec. If the codec is not capable of decoding an input byte sequence, an exception will be thrown.

Since 0.3.0

utf8 :: CodecSource

Since 0.3.0

utf16_le :: CodecSource

Since 0.3.0

utf16_be :: CodecSource

Since 0.3.0

utf32_le :: CodecSource

Since 0.3.0

utf32_be :: CodecSource

Since 0.3.0

ascii :: CodecSource

Since 0.3.0

iso8859_1 :: CodecSource

Since 0.3.0

lines :: Monad m => Conduit Text m TextSource

Emit each line separately

Since 0.4.1

linesBounded :: MonadThrow m => Int -> Conduit Text m TextSource

Variant of the lines function with an integer parameter. The text length of any emitted line never exceeds the value of the paramater. Whenever this is about to happen a LengthExceeded exception is thrown. This function should be used instead of the lines function whenever we are dealing with user input (e.g. a file upload) because we can't be sure that user input won't have extraordinarily large lines which would require large amounts of memory if consumed.

takeWhile :: Monad m => (Char -> Bool) -> Conduit Text m TextSource

Since 1.0.8

dropWhile :: Monad m => (Char -> Bool) -> Consumer Text m ()Source

Since 1.0.8

take :: Monad m => Int -> Conduit Text m TextSource

Since 1.0.8

drop :: Monad m => Int -> Consumer Text m ()Source

Since 1.0.8

foldLines :: Monad m => (a -> ConduitM Text o m a) -> a -> ConduitM Text o m aSource

Since 1.0.8

withLine :: Monad m => Sink Text m a -> Consumer Text m (Maybe a)Source

Since 1.0.8

decodeUtf8 :: MonadThrow m => Conduit ByteString m TextSource

Decode a stream of UTF8-encoded bytes into a stream of text, throwing an exception on invalid input.

Since 1.0.15

encodeUtf8 :: Monad m => Conduit Text m ByteStringSource

Encode a stream of text into a stream of bytes.

Since 1.0.15