formatting-6.1.0: 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

Contents

Description

Combinator-based type-safe formatting (like printf() or FORMAT) for Text.

Example:

>>> format ("Person's name is " % text % ", age is " % hex) "Dave" 54

See Formatting.Formatters for a complete list of formatting combinators.

Synopsis

Top-level functions

format :: Format Text a -> a Source

Run the formatter and return a lazy Text value.

sformat :: Format Text a -> a Source

Run the formatter and return a strict Text value.

bprint :: Format Builder a -> a Source

Run the formatter and return a Builder value.

fprint :: Format (IO ()) a -> a Source

Run the formatter and print out the text to stdout.

hprint :: Handle -> Format (IO ()) a -> a Source

Run the formatter and put the output onto the given Handle.

Formatting library

Other functions

formatToString :: Format [Char] a -> a Source

Run the formatter and return a list of characters.