| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Text.Scanf
- scanf :: Format t -> String -> Maybe t
- printf :: Format t -> t -> String
- data a :+ b = a :+ b
- fmt :: QuasiQuoter
- fmt_ :: (Format () -> Format t) -> Format t
- data Format t
- (%) :: String -> (Format t -> Format q) -> Format t -> Format q
- integer :: Format t -> Format (Integer :+ t)
- int :: Format t -> Format (Int :+ t)
- double :: Format t -> Format (Double :+ t)
- string :: Format t -> Format (String :+ t)
- char :: Format t -> Format (Char :+ t)
Main definitions
A pretty pair type to build lists with values of different types.
Remember to close lists with ().
3:+"14":+() ::Int:+String:+()
Constructors
| a :+ b infixr 1 |
fmt :: QuasiQuoter Source #
Parse a typed Format string.
The following conversion strings are supported:
%d: signed integer (Int)%l: signed integer (Integer, unbounded)%f: floating point (Double)%s: string of non-space characters (String)%c: single character (Char)%%: parse/print a literal percent character
N.B.: in scanf, spaces in the format string match any number of whitespace
character until the next nonspace character.
[fmt|%d lazy %s and %d strict %s|] ::Format(Int:+String:+Int:+String:+())
fmt_ :: (Format () -> Format t) -> Format t Source #
Construct a format string. This is an alternative to fmt
that doesn't rely on Template Haskell.
The components of a format string are composed using ( (function
composition) and .)( (wrapper for constant strings).%)
fmt_(int." lazy "%string." and "%int." strict "%string) ::Format(Int:+String:+Int:+String:+())