text-builder-0.6.10: Efficient strict text builder
Safe HaskellSafe-Inferred
LanguageHaskell2010

TextBuilder

Synopsis

Documentation

data TextBuilder Source #

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

Instances

Instances details
IsString TextBuilder Source # 
Instance details

Defined in TextBuilder

Monoid TextBuilder Source # 
Instance details

Defined in TextBuilder

Semigroup TextBuilder Source # 
Instance details

Defined in TextBuilder

Show TextBuilder Source # 
Instance details

Defined in TextBuilder

type Builder = TextBuilder Source #

Deprecated: Use TextBuilder instead

Accessors

toText :: TextBuilder -> Text Source #

Execute a builder producing a strict text

run :: TextBuilder -> Text Source #

Deprecated: Use toText instead

Alias to toText

length :: TextBuilder -> Int Source #

Get the amount of characters

null :: TextBuilder -> Bool Source #

Check whether the builder is empty

Output IO

putToStdOut :: TextBuilder -> IO () Source #

Put builder, to stdout

putToStdErr :: TextBuilder -> IO () Source #

Put builder, to stderr

putLnToStdOut :: TextBuilder -> IO () Source #

Put builder, followed by a line, to stdout

putLnToStdErr :: TextBuilder -> IO () Source #

Put builder, followed by a line, to stderr

Constructors

Builder manipulators

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

Intercalate builders

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

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

padFromRight :: Int -> Char -> TextBuilder -> TextBuilder Source #

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

Textual

text :: Text -> TextBuilder Source #

Strict text

hexData :: ByteString -> TextBuilder Source #

Hexadecimal readable representation of binary data.

Character

char :: Char -> TextBuilder Source #

Unicode character

Low-level character

unicodeCodePoint :: Int -> TextBuilder Source #

Unicode code point

utf16CodeUnits1 :: Word16 -> TextBuilder Source #

Single code-unit UTF-16 character

utf16CodeUnits2 :: Word16 -> Word16 -> TextBuilder Source #

Double code-unit UTF-16 character

utf8CodeUnits1 :: Word8 -> TextBuilder Source #

Single code-unit UTF-8 character

utf8CodeUnits2 :: Word8 -> Word8 -> TextBuilder Source #

Double code-unit UTF-8 character

utf8CodeUnits3 :: Word8 -> Word8 -> Word8 -> TextBuilder Source #

Triple code-unit UTF-8 character

utf8CodeUnits4 :: Word8 -> Word8 -> Word8 -> Word8 -> TextBuilder Source #

UTF-8 character out of 4 code units

Integers

Decimal

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

Decimal representation of an integral value

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

Decimal representation of an unsigned integral value

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

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

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

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

dataSizeInBytesInDecimal :: Integral a => Char -> a -> TextBuilder Source #

Data size in decimal notation over amount of bytes.

Binary

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

Unsigned binary number

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

Unsigned binary number

Hexadecimal

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

Hexadecimal representation of an integral value

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

Unsigned hexadecimal representation of an integral value

Digits

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

Decimal digit

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

Hexadecimal digit

Real

fixedDouble Source #

Arguments

:: Int

Amount of decimals after point.

-> Double 
-> TextBuilder 

Double with a fixed number of decimal places.

doublePercent Source #

Arguments

:: Int

Amount of decimals after point.

-> Double 
-> TextBuilder 

Double multiplied by 100 with a fixed number of decimal places applied and followed by a percent-sign.

Time

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

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