on 4c51159 help sign in
elk/compiler/SourceSyntax/PrettyPrint.hs
15 lines 310 B history raw
2module SourceSyntax.PrettyPrint where
4import Text.PrettyPrint
5import SourceSyntax.Location
7class Pretty a where
8 pretty :: a -> Doc
10instance Pretty a => Pretty (Located a) where
11 pretty (L _ _ e) = pretty e
13commaCat docs = cat (punctuate comma docs)
15parensIf bool doc = if bool then parens doc else doc