Moduleturtle-1.6.2Haskell2010
Turtle.Format
Minimalist implementation of type-safe formatted strings, borrowing heavily
from the implementation of the formatting package.
Example use of this module:
:set -XOverloadedStringsimport Turtle.Formatformat ("This is a "%s%" string that takes "%d%" arguments") "format" 2"This is a format string that takes 2 arguments"
A Format string that takes no arguments has this type:
"I take 0 arguments" :: Format r r
format "I take 0 arguments" :: Textformat "I take 0 arguments""I take 0 arguments"
A Format string that takes one argument has this type:
"I take "%d%" arguments" :: Format r (Int -> r)
format ("I take "%d%" argument") :: Int -> Textformat ("I take "%d%" argument") 1"I take 1 argument"
A Format string that takes two arguments has this type:
"I "%s%" "%d%" arguments" :: Format r (Text -> Int -> r)
format ("I "%s%" "%d%" arguments") :: Text -> Int -> Textformat ("I "%s%" "%d%" arguments") "take" 2"I take 2 arguments"
- 1 type
- 18 values
- Packageturtle-1.6.2
- Exports19
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceFormat.hs
Format
6 declarationsConcatenate two Format strings
Print a Format string to standard output (without a trailing newline)
printf ("Hello, "%s%"!\n") "world"Hello, world!
Print a Format string to standard err (without a trailing newline)
eprintf ("Hello, "%s%"!\n") "world"Hello, world!
Create your own format specifier