b5887f41c9
printing errors in a prettier way.
18 lines
No EOL
356 B
Haskell
18 lines
No EOL
356 B
Haskell
|
|
module SourceSyntax.PrettyPrint where
|
|
|
|
import Text.PrettyPrint
|
|
import SourceSyntax.Location
|
|
|
|
class Pretty a where
|
|
pretty :: a -> Doc
|
|
|
|
instance Pretty a => Pretty (Located a) where
|
|
pretty (L _ _ e) = pretty e
|
|
|
|
instance Pretty () where
|
|
pretty () = empty
|
|
|
|
commaCat docs = cat (punctuate comma docs)
|
|
|
|
parensIf bool doc = if bool then parens doc else doc |