text-format-heavy-0.1.5.1: Full-weight string formatting library, analog of Python's string.format

Safe HaskellSafe
LanguageHaskell2010

Data.Text.Format.Heavy.Build

Contents

Synopsis

Documentation

format :: VarContainer vars => Format -> vars -> Text Source #

The main formatting function. This function throws error if some error detected during format string parsing or formatting itself.

formatEither :: VarContainer vars => Format -> vars -> Either String Text Source #

The main formatting function. This version returns Left value with error description in case of error in format string or error during formatting.

Formatters building utilities

align :: GenericFormat -> Builder -> Builder Source #

Align text within available width according to format

applySign :: (Num a, Ord a) => Sign -> a -> Builder -> Builder Source #

Add +/- sign to the number representation, if required

applySharp :: Bool -> Radix -> Builder -> Builder Source #

Add 0x to the number representation, if required

convertText :: Maybe Conversion -> Builder -> Builder Source #

Apply text conversion.

formatInt :: Integral a => GenericFormat -> a -> Builder Source #

Format integer number according to GenericFormat

formatStr :: GenericFormat -> Text -> Builder Source #

Format Text according to GenericFormat.

formatFloat :: RealFloat a => GenericFormat -> a -> Builder Source #

Format floating-point number according to GenericFormat

formatBool :: BoolFormat -> Bool -> Builder Source #

Format boolean value.