Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains Formatable and VarContainer instances for most used types.
- data Single a = Single {
- getSingle :: a
- data Several a = Several {
- getSeveral :: [a]
- data Shown a = Shown {
- shown :: a
- data DefaultValue = DefaultValue Variable
- data ThenCheck c1 c2 = ThenCheck c1 c2
- withDefault :: VarContainer c => c -> Variable -> ThenCheck c DefaultValue
- optional :: VarContainer c => c -> ThenCheck c DefaultValue
- genericIntFormat :: Integral a => VarFormat -> a -> Either String Builder
- genericFloatFormat :: RealFloat a => VarFormat -> a -> Either String Builder
Utility data types
Container for single parameter. Example usage:
format "Hello, {}!" (Single name)
Eq a => Eq (Single a) Source # | |
Show a => Show (Single a) Source # | |
Formatable a => VarContainer (Single a) Source # | |
Formatable a => Formatable (Single a) Source # | |
Container for several parameters of the same type. Example usage:
format "{} + {} = {}" $ Several [2, 3, 5]
Several | |
|
Values packed in Shown will be formatted using their Show instance.
For example,
formatText "values: {}." (Shown (True, False)) ==> "values: (True, False)."
Combinators
data DefaultValue Source #
Variable container which contains fixed value for any variable name.
Combiled variable container, which uses parameters from c1
,
and if variable is not found there it will check in c2
.
ThenCheck c1 c2 |
(VarContainer c1, VarContainer c2) => VarContainer (ThenCheck c1 c2) Source # | |
withDefault :: VarContainer c => c -> Variable -> ThenCheck c DefaultValue Source #
optional :: VarContainer c => c -> ThenCheck c DefaultValue Source #
Generic formatters
genericIntFormat :: Integral a => VarFormat -> a -> Either String Builder Source #
Generic formatter for integer types
genericFloatFormat :: RealFloat a => VarFormat -> a -> Either String Builder Source #
Generic formatter for floating-point types