Community
Modules 50

Data.Text.Internal.Lazy.Fusion

experimental

Warning: this is an internal module, and does not have a stable API or name. Functions in this module may not check or enforce preconditions expected by public modules. Use at your own risk!

Core stream fusion functionality for text.

stream :: Text -> Stream Char

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

streamLn :: Text -> Stream Char

O(n) streamLn t = stream (t <> '\n')

unstream :: Stream Char -> Text

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

unstreamChunks :: Int -> Stream Char -> Text

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

length :: Stream Char -> Int64

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

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

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 :: HasCallStack => Stream Char -> Int64 -> Char

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

countChar :: Char -> Stream Char -> Int64

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

Maintainer
bos@serpentine.com
Portability
GHC
Copyright
(c) 2009, 2010 Bryan O'Sullivan
License
BSD-style
Build record and source files

Community contribution. The service has not verified this documentation. The generator reported 2 diagnostics.

Target: Linux on x86-64. Some inferred types and resolved links are not available.

Generator: aihc-haddock-858b1951-web-1

Metadata snapshot: 0b0724abd14577f7a6c8172d62e3e1c0808feb114d4d379402e17f37e3c7801e

Open the dependency plan · Download the documentation model

Import a package

Enter a package name and an exact version from Hackage. The site contains imported versions only.