[commit: ghc] master: Better pretty-printing of types and coercions (21f00c3)
Simon Peyton Jones
simonpj at microsoft.com
Wed Feb 13 18:43:36 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/21f00c32e55f13f995006990608b7d68ba98299f
>---------------------------------------------------------------
commit 21f00c32e55f13f995006990608b7d68ba98299f
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Wed Feb 6 12:53:49 2013 +0000
Better pretty-printing of types and coercions
>---------------------------------------------------------------
compiler/types/Coercion.lhs | 5 ++---
compiler/types/TypeRep.lhs | 6 ++++--
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/compiler/types/Coercion.lhs b/compiler/types/Coercion.lhs
index a3bca74..06f42dc 100644
--- a/compiler/types/Coercion.lhs
+++ b/compiler/types/Coercion.lhs
@@ -512,9 +512,8 @@ ppr_co p (AppCo co1 co2) = maybeParen p TyConPrec $
ppr_co p co@(ForAllCo {}) = ppr_forall_co p co
ppr_co _ (CoVarCo cv) = parenSymOcc (getOccName cv) (ppr cv)
ppr_co p (AxiomInstCo con index cos)
- = angleBrackets (pprPrefixApp p
- (ppr (getName con) <> brackets (ppr index))
- (map (ppr_co TyConPrec) cos))
+ = pprPrefixApp p (ppr (getName con) <> brackets (ppr index))
+ (map (ppr_co TyConPrec) cos)
ppr_co p co@(TransCo {}) = maybeParen p FunPrec $
case trans_co_list co [] of
diff --git a/compiler/types/TypeRep.lhs b/compiler/types/TypeRep.lhs
index f83ed38..c3d7cdf 100644
--- a/compiler/types/TypeRep.lhs
+++ b/compiler/types/TypeRep.lhs
@@ -730,8 +730,10 @@ pprInfixApp p pp pp_tc ty1 ty2
sep [pp FunPrec ty1, pprInfixVar True pp_tc <+> pp FunPrec ty2]
pprPrefixApp :: Prec -> SDoc -> [SDoc] -> SDoc
-pprPrefixApp p pp_fun pp_tys = maybeParen p TyConPrec $
- hang pp_fun 2 (sep pp_tys)
+pprPrefixApp p pp_fun pp_tys
+ | null pp_tys = pp_fun
+ | otherwise = maybeParen p TyConPrec $
+ hang pp_fun 2 (sep pp_tys)
----------------
pprArrowChain :: Prec -> [SDoc] -> SDoc
More information about the ghc-commits
mailing list