text-0.11.2.0: An efficient packed Unicode text type.

PortabilityGHC
Stabilityexperimental
Maintainerbos@serpentine.com, rtomharper@googlemail.com, duncan@haskell.org
Safe HaskellSafe-Infered

Data.Text.Lazy.Fusion

Description

Core stream fusion functionality for text.

Synopsis

Documentation

stream :: Text -> Stream CharSource

O(n) Convert a Text into a 'Stream Char'.

unstream :: Stream Char -> TextSource

O(n) Convert a 'Stream Char' into a Text, using defaultChunkSize.

unstreamChunks :: Int -> Stream Char -> TextSource

O(n) Convert a 'Stream Char' into a Text, using the given chunk size.

length :: Stream Char -> Int64Source

O(n) Returns the number of characters in a text.

unfoldrN :: Int64 -> (a -> Maybe (Char, a)) -> a -> Stream CharSource

O(n) Like unfoldr, unfoldrN builds a stream from a seed value. However, the length of the result is limited by the first argument to unfoldrN. This function is more efficient than unfoldr when the length of the result is known.

index :: Stream Char -> Int64 -> CharSource

O(n) stream index (subscript) operator, starting from 0.

countChar :: Char -> Stream Char -> Int64Source

O(n) The count function returns the number of times the query element appears in the given stream.