| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Data.Text.Format.Heavy.Parse.VarFormat
Synopsis
- pGenericFormat :: Parsec Text st GenericFormat
- parseGenericFormat :: Text -> Either ParseError GenericFormat
- pBoolFormat :: Parsec Text st BoolFormat
- parseBoolFormat :: Text -> Either ParseError BoolFormat
- parseMaybeFormat :: Text -> Maybe (Text, Text)
Documentation
pGenericFormat :: Parsec Text st GenericFormat Source #
Parsec parser for generic (Python-like) variable format.
parseGenericFormat :: Text -> Either ParseError GenericFormat Source #
Parse generic variable format.
Syntax is:
[[fill]align][sign][#][width][.precision][radix][~conversion]
where:
- fill - padding character (space by default)
- align - alignment indicator (
<,>, or^) - sign - when to show number's sign (
+,-, or space) #- if specified, then for hexadecimal numbers the leading0xwill be added- width - minimum length of the field
- precision - number of decimal places after point, for floatting-point numbers
- radix -
horxfor hexadecimal,dfor decimal (default). - conversion - text conversion symbol. Supported are:
u- convert to upper case,l- convert to lower case,t- convert to title case (capitalize all words).
pBoolFormat :: Parsec Text st BoolFormat Source #
Parsec parser for Bool format
parseBoolFormat :: Text -> Either ParseError BoolFormat Source #
Parse Bool format.
Syntax is:
TRUE:FALSE
Colon can be replaced with comma or semicolon.
For example, valid format specifications are true:false (the default one),
True:False, yes:no, and so on.
parseMaybeFormat :: Text -> Maybe (Text, Text) Source #
Try to parse format for Maybe x type.
The syntax is:
someformat|nothing
where someformat is format for the x type, and nothing is the string
to be substituted for Nothing value.
Returns Nothing, if format does not contain |. Otherwise, returns
Just (someformat, nothing).