module TPDB.Pretty
( Doc, SimpleDoc
, render, renderCompact, displayIO
, Pretty (..)
, fsep , hsep, vsep, vcat, hcat
, parens, brackets, angles, braces, enclose
, punctuate, comma, nest
, empty, text
, (<>), (<+>), ($$)
)
where
import Text.PrettyPrint.Leijen.Text
hiding ( text, (<+>), vcat )
import qualified Text.PrettyPrint.Leijen.Text
import Data.String ( fromString )
fsep = fillSep
($$) = (<$$>)
x <+> y = x Text.PrettyPrint.Leijen.Text.<+> align y
vcat = align . Text.PrettyPrint.Leijen.Text.vcat
render :: Doc -> String
render = show
text :: String -> Doc
text = fromString
instance ( Pretty a, Pretty b, Pretty c, Pretty d ) => Pretty (a,b,c,d) where
pretty (x,y,z,u) = parens $ fsep $ punctuate comma [ pretty x, pretty y, pretty z, pretty u ]