|
Data.Text.Lazy.Builder | Portability | portable to Hugs and GHC | Stability | experimental | Maintainer | Johan Tibell <johan.tibell@gmail.com> |
|
|
|
|
|
Description |
Efficient construction of lazy texts.
|
|
Synopsis |
|
|
|
|
The Builder type
|
|
|
A Builder is an efficient way to build lazy Texts. There
are several functions for constructing Builders, but only one to
inspect them: to extract any data, you have to turn them into lazy
Texts using toLazyText.
Internally, a Builder constructs a lazy Text by filling byte
arrays piece by piece. As each buffer is filled, it is 'popped'
off, to become a new chunk of the resulting lazy Text. All
this is hidden from the user of the Builder.
| Instances | |
|
|
|
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.
|
|
Constructing Builders
|
|
|
O(1). A Builder taking a single character, satisfying
|
|
|
O(1). A Builder taking a Text, satisfying
|
|
|
O(1). A Builder taking a lazy Text, satisfying
|
|
Flushing the buffer state
|
|
|
O(1). Pop the Text we have constructed so far, if any,
yielding a new chunk in the result lazy Text.
|
|
Produced by Haddock version 2.6.1 |