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 x :: a
x = Int -> a -> Doc
forall a. Pretty a => Int -> a -> Doc
prettyP 0 a
x
prettyParen :: Bool -> Doc -> Doc
prettyParen :: Bool -> Doc -> Doc
prettyParen b :: Bool
b doc :: Doc
doc
= if Bool
b then Doc -> Doc
parens Doc
doc else Doc
doc
prettyParenIndent :: Bool -> Doc -> Doc
prettyParenIndent :: Bool -> Doc -> Doc
prettyParenIndent b :: Bool
b doc :: Doc
doc
= if Bool
b
then [Doc] -> Doc
vcat [Doc
lparen, Int -> Doc -> Doc
nest 2 Doc
doc, Doc
rparen]
else Doc
doc