[commit: template-haskell] th-new: Properly pretty-print let expressions and do expressions. (a62b7f9)
Geoffrey Mainland
gmainlan at microsoft.com
Wed May 29 19:21:21 CEST 2013
Repository : ssh://darcs.haskell.org//srv/darcs/packages/template-haskell
On branch : th-new
http://hackage.haskell.org/trac/ghc/changeset/a62b7f9f739d318d596c9ef167f8d12cc26f4c52
>---------------------------------------------------------------
commit a62b7f9f739d318d596c9ef167f8d12cc26f4c52
Author: Geoffrey Mainland <mainland at apeiron.net>
Date: Wed May 29 18:13:35 2013 +0100
Properly pretty-print let expressions and do expressions.
Since pretty-printing does not generate proper layout, we always need the
braces. Without braces, we print out programs that cannot be parsed as Haskell.
>---------------------------------------------------------------
Language/Haskell/TH/Ppr.hs | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/Language/Haskell/TH/Ppr.hs b/Language/Haskell/TH/Ppr.hs
index 99f0564..6e96e7f 100644
--- a/Language/Haskell/TH/Ppr.hs
+++ b/Language/Haskell/TH/Ppr.hs
@@ -156,6 +156,8 @@ instance Ppr Stmt where
ppr (ParS sss) = sep $ punctuate (text "|")
$ map (sep . punctuate comma . map ppr) sss
+ ppr_list = braces . vcat . map ppr
+
------------------------------
instance Ppr Match where
ppr (Match p rhs ds) = ppr p <+> pprBody False rhs
@@ -235,6 +237,7 @@ pprPat _ (ViewP e p) = parens $ pprExp noPrec e <+> text "->" <+> pprPat noPrec
------------------------------
instance Ppr Dec where
ppr = ppr_dec True
+ ppr_list = braces . vcat . map ppr
ppr_dec :: Bool -- declaration on the toplevel?
-> Dec
More information about the ghc-commits
mailing list