| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Text.Lazy.Builder
Contents
Synopsis
- data Builder
- toLazyText :: Builder -> Text
- toLazyTextWith :: Int -> Builder -> Text
- singleton :: Char -> Builder
- fromText :: Text -> Builder
- fromLazyText :: Text -> Builder
- fromString :: String -> Builder
- flush :: Builder
- decimal :: Integral a => a -> Builder
- hexadecimal :: Integral a => a -> Builder
- data FPFormat
- realFloat :: RealFloat a => a -> Builder
- formatRealFloat :: RealFloat a => FPFormat -> Maybe Int -> a -> Builder
Builder
A Builder is an efficient way to build lazy Text values.
There are several functions for constructing builders, but only one
to inspect them: to extract any data, you have to turn them into
lazy Text values using toLazyText.
Internally, a builder constructs a lazy Text by filling 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.
toLazyText :: Builder -> Text #
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.
toLazyTextWith :: Int -> Builder -> Text #
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.
singleton :: Char -> Builder #
O(1). A Builder taking a single character, satisfying
toLazyText(singletonc) =singletonc
O(1). A Builder taking a Text, satisfying
toLazyText(fromTextt) =fromChunks[t]
fromLazyText :: Text -> Builder #
O(1). A Builder taking a lazy Text, satisfying
toLazyText(fromLazyTextt) = t
fromString :: String -> Builder #
O(1). A Builder taking a String, satisfying
toLazyText(fromStrings) =fromChunks[S.pack s]
O(1). Pop the strict Text we have constructed so far, if any,
yielding a new chunk in the result lazy Text.
hexadecimal :: Integral a => a -> Builder #
Control the rendering of floating point numbers.
Constructors
| Exponent | Scientific notation (e.g. |
| Fixed | Standard decimal notation. |
| Generic | Use decimal notation for values between |
Instances
| Enum FPFormat | |
Defined in Data.Text.Lazy.Builder.RealFloat | |
| Read FPFormat | |
| Show FPFormat | |