formatting-5.4: Combinator-based type-safe formatting (like printf() or FORMAT)

Copyright(c) 2013 Chris Done, 2013 Shachaf Ben-Kiki
LicenseBSD3
Maintainerchrisdone@gmail.com
Stabilityexperimental
PortabilityGHC
Safe HaskellNone
LanguageHaskell98

Formatting.ShortFormatters

Description

Single letters for short formatting.

Synopsis

Documentation

t :: Format Text Source

Output a lazy text.

d :: Integral a => Format a Source

Render an integral e.g. 123 -> "123", 0 -> "0".

b :: Integral a => Format a Source

Render an integer using binary notation. (No leading 0b is added.)

o :: Integral a => Format a Source

Render an integer using octal notation. (No leading 0o is added.)

x :: Integral a => Format a Source

Render an integer using hexadecimal notation. (No leading 0x is added.)

st :: Format Text Source

Output a strict text.

s :: Format String Source

Output a string.

sh :: Show a => Format a Source

Output a showable value (instance of Show) by turning it into Text.

c :: Format Char Source

Output a character.

ef :: Real a => Int -> Format a Source

Render a floating point number using scientific/engineering notation (e.g. 2.3e123), with the given number of decimal places.

f :: Real a => Int -> Format a Source

Render a floating point number using normal notation, with the given number of decimal places.

pf :: Real a => Int -> Format a Source

Render a floating point number, with the given number of digits of precision. Uses decimal notation for values between 0.1 and 9,999,999, and scientific notation otherwise.

sf :: Real a => Format a Source

Render a floating point number using the smallest number of digits that correctly represent it.

l :: Buildable a => Int -> Char -> Format a Source

Pad the left hand side of a string until it reaches k characters wide, if necessary filling with character ch.

r :: Buildable a => Int -> Char -> Format a Source

Pad the right hand side of a string until it reaches k characters wide, if necessary filling with character ch.