| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell98 |
Formatting.Internal
Description
Internal format starters.
- newtype Format r a = Format {}
- (%) :: Format r a -> Format r' r -> Format r' a
- (%.) :: Format r (Builder -> r') -> Format r' a -> Format r a
- now :: Builder -> Format r r
- bind :: Format r a -> (Builder -> Format r' r) -> Format r' a
- later :: (a -> Builder) -> Format r (a -> r)
- format :: Format Text a -> a
- sformat :: Format Text a -> a
- bprint :: Format Builder a -> a
- fprint :: Format (IO ()) a -> a
- hprint :: Handle -> Format (IO ()) a -> a
- formatToString :: Format [Char] a -> a
Documentation
A formatter. The r type means the returned value at the
end. The more formatters you compose, the more this wil build up
arguments from r to Int -> r to Char -> (Int -> r), etc.
Instances
| Category * Format | The same as (%). At present using |
| (~) * a r => IsString (Format r a) | Useful instance for writing format string. With this you can
write |
| Monoid (Format r (a -> r)) | Useful instance for applying two formatters to the same input
argument. For example: |
(%.) :: Format r (Builder -> r') -> Format r' a -> Format r a infixr 8 Source
Function compose two formatters. Will feed the result of one formatter into another.
bind :: Format r a -> (Builder -> Format r' r) -> Format r' a Source
Monadic indexed bind for holey monoids.
later :: (a -> Builder) -> Format r (a -> r) Source
Insert a function which accepts some argument and produces a
Builder which is appended to the output at the end.
later (f :: Int -> Builder) produces Format r (Int -> r).
hprint :: Handle -> Format (IO ()) a -> a Source
Run the formatter and put the output onto the given Handle.
formatToString :: Format [Char] a -> a Source
Run the formatter and return a list of characters.