projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2ebd4bf
)
Fix pretty-printing precedence for equality constraints
author
simonpj@microsoft.com
<unknown>
Fri, 2 Oct 2009 11:15:49 +0000
(11:15 +0000)
committer
simonpj@microsoft.com
<unknown>
Fri, 2 Oct 2009 11:15:49 +0000
(11:15 +0000)
compiler/types/TypeRep.lhs
patch
|
blob
|
history
diff --git
a/compiler/types/TypeRep.lhs
b/compiler/types/TypeRep.lhs
index
c3bd746
..
5c29087
100644
(file)
--- a/
compiler/types/TypeRep.lhs
+++ b/
compiler/types/TypeRep.lhs
@@
-431,7
+431,13
@@
pprTypeApp tc tys = ppr_type_app TopPrec (getName tc) tys
pprPred :: PredType -> SDoc
pprPred (ClassP cls tys) = pprClassPred cls tys
pprPred (IParam ip ty) = ppr ip <> dcolon <> pprType ty
pprPred :: PredType -> SDoc
pprPred (ClassP cls tys) = pprClassPred cls tys
pprPred (IParam ip ty) = ppr ip <> dcolon <> pprType ty
-pprPred (EqPred ty1 ty2) = sep [ppr ty1, nest 2 (ptext (sLit "~")), ppr ty2]
+pprPred (EqPred ty1 ty2) = sep [ ppr_type FunPrec ty1
+ , nest 2 (ptext (sLit "~"))
+ , ppr_type FunPrec ty2]
+ -- Precedence looks like (->) so that we get
+ -- Maybe a ~ Bool
+ -- (a->a) ~ Bool
+ -- Note parens on the latter!
pprClassPred :: Class -> [Type] -> SDoc
pprClassPred clas tys = ppr_type_app TopPrec (getName clas) tys
pprClassPred :: Class -> [Type] -> SDoc
pprClassPred clas tys = ppr_type_app TopPrec (getName clas) tys