>>> format (flooredTo int) 6.66 "6" >>> format (list (flooredTo int)) [10.66, 6.66, 1.0, 3.4] "[10, 6, 1, 3]"Note: the type variable f will almost always be 'Format r', so the type of this function can be thought of as:
flooredTo :: (Integral i, RealFrac d) => Format r (i -> r) -> Format r (d -> r)
>>> format ("Person's name is " % text % ", age is " % hex) "Dave" 54 "Person's name is Dave, age is 36"See Formatting.Formatters for a list of formatters. See Formatting.Combinators for a list of formatting combinators, for combining and altering formatters.
myFormat :: Format r (Text -> Int -> r) myFormat = "Person's name is " % text % ", age is " % hexthe first type parameter remains polymorphic, and the second type parameter is Text -> Int -> r, which indicates that it formats a Text and an Int. When you run the Format, for example with format, you provide the arguments and they will be formatted into a string.
> format ("Person's name is " % text % ", age is " % hex) "Dave" 54 "Person's name is Dave, age is 36"
myFormat :: Format r (Text -> Int -> r) myFormat = "Person's name is " % text % ", age is " % hexthe first type parameter remains polymorphic, and the second type parameter is Text -> Int -> r, which indicates that it formats a Text and an Int. When you run the Format, for example with format, you provide the arguments and they will be formatted into a string.
> format ("Person's name is " % text % ", age is " % hex) "Dave" 54 "Person's name is Dave, age is 36"