ginger2
Safe HaskellNone
LanguageHaskell2010

Language.Ginger.StringFormatting

Synopsis

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.

data FormatArg Source #

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 ({0[0]})

DictArg !(Map Text FormatArg)

Dictionary argument; cannot be formatted directly, but can be accessed using index syntax ({0[key]}) or attribute syntax (0.key).

PolyArg

Polymorphic argument; may offer any of the available representations, allowing the formatter to pick the most appropriate one.

Fields

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.

Instances

Instances details
Bounded FormattingGroup Source # 
Instance details

Defined in Language.Ginger.StringFormatting.Python

Enum FormattingGroup Source # 
Instance details

Defined in Language.Ginger.StringFormatting.Python

Show FormattingGroup Source # 
Instance details

Defined in Language.Ginger.StringFormatting.Python

Eq FormattingGroup Source # 
Instance details

Defined in Language.Ginger.StringFormatting.Python

Ord FormattingGroup Source # 
Instance details

Defined in Language.Ginger.StringFormatting.Python