module Lambdabot.Plugin.Haskell.Free.Util (
    Pretty(..),
    prettyParen,
    prettyParenIndent,
    module Text.PrettyPrint.HughesPJ
) where


import Text.PrettyPrint.HughesPJ


class Pretty a where
    prettyP :: Int -> a -> Doc

    pretty :: a -> Doc
    pretty a
x = Int -> a -> Doc
forall a. Pretty a => Int -> a -> Doc
prettyP Int
0 a
x


prettyParen :: Bool -> Doc -> Doc
prettyParen :: Bool -> Doc -> Doc
prettyParen Bool
b Doc
doc
    = if Bool
b then Doc -> Doc
parens Doc
doc else Doc
doc

prettyParenIndent :: Bool -> Doc -> Doc
prettyParenIndent :: Bool -> Doc -> Doc
prettyParenIndent Bool
b Doc
doc
    = if Bool
b
      then [Doc] -> Doc
vcat [Doc
lparen, Int -> Doc -> Doc
nest Int
2 Doc
doc, Doc
rparen]
      else Doc
doc


-- vim: ts=4:sts=4:expandtab