Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data a :+ b = a :+ b
- data Format t where
- emptyFmt :: Format ()
- fmt_ :: (Format () -> Format t) -> Format t
- (%) :: String -> (Format t -> Format q) -> Format t -> Format q
- constant :: String -> Format t -> Format t
- constant' :: String -> Format t -> Format t
- whitespace :: String -> Format t -> Format t
- readable :: (Read a, Show a) => Format t -> Format (a :+ t)
- 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)
- readmap :: (a -> b) -> ReadS a -> ReadS b
- readsFormat :: Format t -> ReadS t
- scanf :: Format t -> String -> Maybe t
- printf :: Format t -> t -> String
Documentation
A pretty pair type to build lists with values of different types.
Remember to close lists with ()
.
3:+
"14":+
() ::Int
:+
String
:+
()
a :+ b infixr 1 |
Typed
/scanf
format strings.
They can be built using the printf
fmt
quasiquote or
with the fmt_
function and format combinators.
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
:+
())
(%) :: String -> (Format t -> Format q) -> Format t -> Format q infixr 9 Source #
Append a constant string to a format string component.
N.B.: in scanf
, spaces in the format string match any number of whitespace
character until the next nonspace character.
constant' :: String -> Format t -> Format t Source #
Append a constant string with no whitespace to a format string.
whitespace :: String -> Format t -> Format t Source #
Append a constant whitespace string to a format string.
readsFormat :: Format t -> ReadS t Source #