Lazy -bytestring +text
A time and space-efficient implementation of Unicode text using lists of packed arrays.
Note: Read below the synopsis for important notes on the use of this module.
The representation used by this module is suitable for high performance use and for streaming large quantities of data. It provides a means to manipulate a large body of text without requiring that the entire content be resident in memory.
Some operations, such as concat, append, reverse and cons, have better time complexity than their Data.Text equivalents, due to the underlying representation being a list of chunks. For other operations, lazy Texts are usually within a few percent of strict ones, but often with better heap usage if used in a streaming fashion. For data larger than available memory, or if you have tight memory constraints, this module will be the only option.
This module is intended to be imported qualified, to avoid name clashes with Prelude functions. eg.
> import qualified Data.Text.Lazy as L
Check the invariant lazily.
O(1). A Builder taking a lazy Text, satisfying
* (fromLazyText t) =
O(n). Extract a lazy Text from a Builder with a default buffer size. The construction work takes place if and when the relevant part of the lazy Text is demanded.
O(n). Extract a lazy Text from a Builder, using the given size for the initial buffer. The construction work takes place if and when the relevant part of the lazy Text is demanded.
If the initial buffer is too small to hold all data, subsequent buffers will be the default buffer size.