|
|
|
|
|
Description |
General text formatting routines, similar to C printf-style formatting.
General pattern format
'%' '%' output literal '%'
'%' flags width '.' precision '\'' string '\'' always print string as is.
'%' flags width '.' precision formatChar passed to class instance.
'%' '(' sub1, sub2, ... ')' flags width '.' precision formatChar subpatterns
Flags is zero or more of the following
' ' a blank should be left before positive numbers
'#' value should be printed in alternate form
'0' value should be zero padded
'-' value should be left adjusted
'+' value should always have a sign
'\'' numerical values should be grouped
formatChar is a character affecting formatting
'/' always format as if by the following translation
fmt "%fx.yv" [fa x] -> fmt "%fx.ys" [fa (show x)]
'l' format as list
's' print list compactly, similar to %(%c)l
'x' hexadecimal
'i' integral
'b' binary
'o' octal
'c' print compactly, as is used in 's'
|
|
Synopsis |
|
|
|
|
The Format class
|
|
class Show a => Format a where |
class for use with fa
| | Methods | | | Instances | |
|
|
Functions
|
|
Formatting routines
|
|
fmt :: String -> [F] -> String |
main formatting routine.
fmt "%s has %i pets" [fa "John", fi 3]
|
|
fmtS :: String -> String -> String |
format a single string
|
|
fmtSs :: String -> [String] -> String |
format a set of strings
|
|
errorf :: String -> [F] -> a |
throws an error created by format
|
|
Arguments
|
|
fa :: Format a => a -> F |
format anything
|
|
fS :: Show a => a -> F |
format showable
|
|
fi :: Int -> F |
format integer. specialization of fa, useful to resolve ambiguity.
|
|
fs :: String -> F |
format string. specialization of fa, useful to resolve ambiguity.
|
|
ff :: Float -> F |
format float. specialization of fa, useful to resolve ambiguity.
|
|
Internals, useful for creating instances of Format
|
|
data Pattern |
the type of patterns
| Constructors | Pattern | | patternSub :: [String] | subpatterns
| patternFlags :: [Char] | | patternWidth :: (Maybe Int) | | patternPrecision :: (Maybe Int) | | patternChar :: Char | |
|
|
|
|
formatIntegral :: Integral n => n -> Pattern -> String |
|
formatString :: String -> Pattern -> String |
|
formatShow :: Show a => a -> Pattern -> String |
|
Produced by Haddock version 0.8 |