PyF-0.5.0.0: Quasiquotations for a python like interpolated string formater

Safe HaskellSafe
LanguageHaskell2010

PyF.Formatters

Contents

Description

Formatters for integral / fractional and strings.

Is support:

For all types:

  • Grouping of the integral part (i.e: adding a custom char to separate groups of digits)
  • Padding (left, right, around, and between the sign and the number)
  • Sign handling (i.e: display the positive sign or not)

For floating:

  • Precision
  • Fixed Exponential Generic formatting

For integrals:

  • Binary Hexa Octal / Character representation

Synopsis

Generic formating function

formatString Source #

Arguments

:: Maybe (Int, AlignMode AlignAll, Char)

Padding

-> Maybe Int

Precision (will truncate before padding)

-> String 
-> String 

Format a string

formatIntegral Source #

Arguments

:: (Show i, Integral i) 
=> Format t t' Integral 
-> SignMode 
-> Maybe (Int, AlignMode k, Char)

Padding

-> Maybe (Int, Char)

Grouping

-> i 
-> String 

Format an integral number

formatFractional Source #

Arguments

:: RealFloat f 
=> Format t t' Fractional 
-> SignMode 
-> Maybe (Int, AlignMode k, Char)

Padding

-> Maybe (Int, Char)

Grouping

-> Maybe Int

Precision

-> f 
-> String 

Format a fractional number

Formatter details

data AltStatus Source #

This formatter support alternate version

Constructors

CanAlt 
NoAlt 

data UpperStatus Source #

This formatter support Upper case version

Constructors

CanUpper 
NoUpper 

data FormatType Source #

This formatter formats an integral or a fractional

Constructors

Fractional 
Integral 

data SignMode Source #

Sign handling

Constructors

Plus

Display - sign and + sign

Minus

Only display - sign

Space

Display - sign and a space for positive numbers

data AnyAlign where Source #

Existential version of AlignMode

Constructors

AnyAlign :: AlignMode (k :: AlignForString) -> AnyAlign 

Internal usage only

data AlignMode (k :: AlignForString) where Source #

Alignement

Constructors

AlignLeft :: AlignMode AlignAll

Left padding

AlignRight :: AlignMode AlignAll

Right padding

AlignInside :: AlignMode AlignNumber

Padding will be added between the sign and the number

AlignCenter :: AlignMode AlignAll

Padding will be added around the valueber

Instances