on a3a7b3e help sign in
elk/compiler/SourceSyntax/PrettyPrint.hs
18 lines 356 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
13instance Pretty () where
14 pretty () = empty
16commaCat docs = cat (punctuate comma docs)
18parensIf bool doc = if bool then parens doc else doc