Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Data.Text.Format.Heavy.Types
Description
This module contains basic type definitions
Synopsis
- type VarName = Text
- type VarFormat = Maybe Text
- data FormatItem
- data Format = Format [FormatItem]
- appendFormat :: Format -> Format -> Format
- class (Default f, Show f) => IsVarFormat f where
- parseVarFormat :: Text -> Either String f
- class Formatable a where
- data Variable = Formatable a => Variable a
- formatAnyVar :: VarFormat -> Variable -> Either String Builder
- class VarContainer c where
- class VarContainer c => ClosedVarContainer c where
- allVarNames :: c -> [VarName]
Documentation
data FormatItem Source #
String format item.
Instances
Eq FormatItem Source # | |
Defined in Data.Text.Format.Heavy.Types | |
Show FormatItem Source # | |
Defined in Data.Text.Format.Heavy.Types Methods showsPrec :: Int -> FormatItem -> ShowS # show :: FormatItem -> String # showList :: [FormatItem] -> ShowS # |
String format
Constructors
Format [FormatItem] |
class (Default f, Show f) => IsVarFormat f where Source #
Can be used for different data types describing formats of specific types.
Instances
IsVarFormat () Source # | |
Defined in Data.Text.Format.Heavy.Types | |
IsVarFormat BoolFormat Source # | |
Defined in Data.Text.Format.Heavy.Instances Methods parseVarFormat :: Text -> Either String BoolFormat Source # | |
IsVarFormat GenericFormat Source # | |
Defined in Data.Text.Format.Heavy.Instances Methods parseVarFormat :: Text -> Either String GenericFormat Source # |
class Formatable a where Source #
Value that can be formatted to be substituted into format string.
Methods
Arguments
:: VarFormat | Variable format specification in text form. Nothing is for default format. |
-> a | Variable value. |
-> Either String Builder | Left for errors in variable format syntax, or errors during formatting. |
Format variable according to format specification. This function should usually parse format specification by itself.
Instances
Any variable that can be substituted.
This type may be also used to construct heterogeneous lists:
[Variable 1, Variable "x"] :: [Variable]
.
Constructors
Formatable a => Variable a |
formatAnyVar :: VarFormat -> Variable -> Either String Builder Source #
Format one variable according to format specification.
class VarContainer c where Source #
Data structure that contains some number of variables.
Instances
class VarContainer c => ClosedVarContainer c where Source #
Methods
allVarNames :: c -> [VarName] Source #