Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Ginger.StringFormatting
Synopsis
- printfList :: PrintfArg a => String -> [a] -> String
- formatList :: Text -> [(Maybe Text, FormatArg)] -> Either String Text
- data FormatArg
- data FormattingGroup
Documentation
formatList :: Text -> [(Maybe Text, FormatArg)] -> Either String Text Source #
Apply format string, passing arguments as a list of optional key / value pairs. All arguments can be addressed positionally; those that have a key that is a valid identifier can also be addressed by that.
Formattable argument. We reduce potential inputs to a limited set of representations; it is the responsibility of the caller to convert whatever values they want to use as formatting args to this type.
Constructors
IntArg !Integer | Integer arguments |
FloatArg !Double | Floating-point arguments |
StringArg !Text | Any scalar argument that is best represented as a string |
ListArg !(Vector FormatArg) | List argument; cannot be formatted directly, but can be accessed
using index syntax ( |
DictArg !(Map Text FormatArg) | Dictionary argument; cannot be formatted directly, but can be accessed
using index syntax ( |
PolyArg | Polymorphic argument; may offer any of the available representations, allowing the formatter to pick the most appropriate one. |
Instances
Show FormatArg Source # | |
Eq FormatArg Source # | |
Ord FormatArg Source # | |
Defined in Language.Ginger.StringFormatting.Python |
data FormattingGroup Source #
Formatting group; this determines the interpretation of formatting types
such as g
, which will behave differently depending on the type of
argument.
Constructors
FormatAsInt | |
FormatAsFloat | |
FormatAsString | |
FormatInvalid |