planet-mitchell-0.1.0: Planet Mitchell

Safe HaskellSafe
LanguageHaskell2010

Text.Lazy.Builder

Contents

Synopsis

Builder

data 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.

Instances
Eq Builder 
Instance details

Defined in Data.Text.Internal.Builder

Methods

(==) :: Builder -> Builder -> Bool #

(/=) :: Builder -> Builder -> Bool #

Ord Builder 
Instance details

Defined in Data.Text.Internal.Builder

Show Builder 
Instance details

Defined in Data.Text.Internal.Builder

IsString Builder 
Instance details

Defined in Data.Text.Internal.Builder

Methods

fromString :: String -> Builder #

Semigroup Builder 
Instance details

Defined in Data.Text.Internal.Builder

Monoid Builder 
Instance details

Defined in Data.Text.Internal.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

fromText :: Text -> Builder #

O(1). A Builder taking a Text, satisfying

fromLazyText :: Text -> Builder #

O(1). A Builder taking a lazy Text, satisfying

fromString :: String -> Builder #

O(1). A Builder taking a String, satisfying

flush :: Builder #

O(1). Pop the strict Text we have constructed so far, if any, yielding a new chunk in the result lazy Text.

decimal :: Integral a => a -> Builder #

data FPFormat #

Control the rendering of floating point numbers.

Constructors

Exponent

Scientific notation (e.g. 2.3e123).

Fixed

Standard decimal notation.

Generic

Use decimal notation for values between 0.1 and 9,999,999, and scientific notation otherwise.

realFloat :: RealFloat a => a -> Builder #

Show a signed RealFloat value to full precision, using standard decimal notation for arguments whose absolute value lies between 0.1 and 9,999,999, and scientific notation otherwise.

formatRealFloat #

Arguments

:: RealFloat a 
=> FPFormat 
-> Maybe Int

Number of decimal places to render.

-> a 
-> Builder