{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS -Wall #-}
module Formatting.ShortFormatters where
import Formatting.Formatters (bin, int, oct)
import Formatting.Internal
import qualified Data.Text as S
import qualified Data.Text as T
import qualified Data.Text.Format as T
import Data.Text.Lazy (Text)
import qualified Data.Text.Lazy.Builder as T
import Formatting.Buildable (Buildable)
import qualified Formatting.Buildable as B (build)
t :: Format r (Text -> r)
t = later T.fromLazyText
d :: Integral a => Format r (a -> r)
d = int
b :: Integral a => Format r (a -> r)
b = bin
o :: Integral a => Format r (a -> r)
o = oct
x :: Integral a => Format r (a -> r)
x = later T.hex
st :: Format r (S.Text -> r)
st = later T.fromText
s :: Format r (String -> r)
s = later (T.fromText . T.pack)
sh :: Show a => Format r (a -> r)
sh = later (T.fromText . T.pack . show)
c :: Format r (Char -> r)
c = later B.build
f :: Real a => Int -> Format r (a -> r)
f i = later (T.fixed i)
sf :: Real a => Format r (a -> r)
sf = later T.shortest
l :: Buildable a => Int -> Char -> Format r (a -> r)
l i ch = later (T.left i ch)
r :: Buildable a => Int -> Char -> Format r (a -> r)
r i ch = later (T.right i ch)