{-# LANGUAGE OverloadedStrings #-}
module Data.Text.Format.Heavy.Formats where
import Data.Default
import qualified Data.Text.Lazy as TL
import Data.Text.Format.Heavy.Types
data Align = AlignLeft | AlignRight | AlignCenter
deriving (Eq, Show)
data Sign = Always | OnlyNegative | SpaceForPositive
deriving (Eq, Show)
data Radix = Decimal | Hexadecimal
deriving (Eq, Show)
data Conversion =
UpperCase
| LowerCase
| TitleCase
deriving (Eq, Show)
data GenericFormat = GenericFormat {
gfFillChar :: Char
, gfAlign :: Maybe Align
, gfSign :: Sign
, gfLeading0x :: Bool
, gfWidth :: Maybe Int
, gfPrecision :: Maybe Int
, gfRadix :: Maybe Radix
, gfConvert :: Maybe Conversion
}
deriving (Eq, Show)
instance Default GenericFormat where
def = GenericFormat {
gfFillChar = ' '
, gfAlign = Nothing
, gfSign = OnlyNegative
, gfLeading0x = False
, gfWidth = Nothing
, gfPrecision = Nothing
, gfRadix = Nothing
, gfConvert = Nothing
}
data BoolFormat = BoolFormat {
bfTrue :: TL.Text
, bfFalse :: TL.Text
}
deriving (Eq, Show)
instance Default BoolFormat where
def = BoolFormat "true" "false"