text-builder-0.6.4: An efficient strict text builder

Safe HaskellNone
LanguageHaskell2010

Text.Builder

Contents

Synopsis

Documentation

data Builder Source #

Specification of how to efficiently construct strict Text. Provides instances of Semigroup and Monoid, which have complexity of O(1).

Instances
IsString Builder Source # 
Instance details

Defined in Text.Builder

Methods

fromString :: String -> Builder #

Semigroup Builder Source # 
Instance details

Defined in Text.Builder

Monoid Builder Source # 
Instance details

Defined in Text.Builder

Accessors

run :: Builder -> Text Source #

Execute a builder producing a strict text

length :: Builder -> Int Source #

Get the amount of characters

null :: Builder -> Bool Source #

Check whether the builder is empty

Output IO

putToStdOut :: Builder -> IO () Source #

Put builder, to stdout

putToStdErr :: Builder -> IO () Source #

Put builder, to stderr

putLnToStdOut :: Builder -> IO () Source #

Put builder, followed by a line, to stdout

putLnToStdErr :: Builder -> IO () Source #

Put builder, followed by a line, to stderr

Constructors

Builder manipulators

intercalate :: Foldable foldable => Builder -> foldable Builder -> Builder Source #

Intercalate builders

padFromLeft :: Int -> Char -> Builder -> Builder Source #

Pad a builder from the left side to the specified length with the specified character

Textual

text :: Text -> Builder Source #

Strict text

asciiByteString :: ByteString -> Builder Source #

ASCII byte string

Character

char :: Char -> Builder Source #

Unicode character

Low-level character

unicodeCodePoint :: Int -> Builder Source #

Unicode code point

utf16CodeUnits1 :: Word16 -> Builder Source #

Single code-unit UTF-16 character

utf16CodeUnits2 :: Word16 -> Word16 -> Builder Source #

Double code-unit UTF-16 character

utf8CodeUnits1 :: Word8 -> Builder Source #

Single code-unit UTF-8 character

utf8CodeUnits2 :: Word8 -> Word8 -> Builder Source #

Double code-unit UTF-8 character

utf8CodeUnits3 :: Word8 -> Word8 -> Word8 -> Builder Source #

Triple code-unit UTF-8 character

utf8CodeUnits4 :: Word8 -> Word8 -> Word8 -> Word8 -> Builder Source #

UTF-8 character out of 4 code units

Integers

Decimal

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

Decimal representation of an integral value

unsignedDecimal :: Integral a => a -> Builder Source #

Decimal representation of an unsigned integral value

thousandSeparatedDecimal :: Integral a => Char -> a -> Builder Source #

Decimal representation of an integral value with thousands separated by the specified character

thousandSeparatedUnsignedDecimal :: Integral a => Char -> a -> Builder Source #

Decimal representation of an unsigned integral value with thousands separated by the specified character

Binary

unsignedBinary :: Integral a => a -> Builder Source #

Unsigned binary number

unsignedPaddedBinary :: (Integral a, FiniteBits a) => a -> Builder Source #

Unsigned binary number

Hexadecimal

hexadecimal :: Integral a => a -> Builder Source #

Hexadecimal representation of an integral value

unsignedHexadecimal :: Integral a => a -> Builder Source #

Unsigned hexadecimal representation of an integral value

Digits

decimalDigit :: Integral a => a -> Builder Source #

Decimal digit

hexadecimalDigit :: Integral a => a -> Builder Source #

Hexadecimal digit

Real

fixedDouble Source #

Arguments

:: Int

Amount of decimals after point.

-> Double 
-> Builder 

Double with a fixed number of decimal places.

Time

intervalInSeconds :: RealFrac seconds => seconds -> Builder Source #

Time interval in seconds. Directly applicable to DiffTime and NominalDiffTime.