on b23ff22 help sign in
elk/compiler/SourceSyntax/PrettyPrint.hs
18 lines 385 B history raw
2module SourceSyntax.PrettyPrint where
4import Text.PrettyPrint
5import qualified SourceSyntax.Helpers as Help
7class Pretty a where
8 pretty :: a -> Doc
10instance Pretty () where
11 pretty () = empty
13commaCat docs = cat (punctuate comma docs)
14commaSep docs = sep (punctuate comma docs)
16parensIf bool doc = if bool then parens doc else doc
18variable x = parensIf (Help.isOp x) (text x)