[commit: ghc] wip/new-flatten-skolems-Aug14: Better printing for TcTyVars in dump style (a333a46)

git at git.haskell.org git at git.haskell.org
Wed Oct 1 11:57:02 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/new-flatten-skolems-Aug14
Link       : http://ghc.haskell.org/trac/ghc/changeset/a333a462273792207ee5c062ede330270aabf77c/ghc

>---------------------------------------------------------------

commit a333a462273792207ee5c062ede330270aabf77c
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Sep 30 21:28:15 2014 +0100

    Better printing for TcTyVars in dump style


>---------------------------------------------------------------

a333a462273792207ee5c062ede330270aabf77c
 compiler/basicTypes/Var.lhs | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/compiler/basicTypes/Var.lhs b/compiler/basicTypes/Var.lhs
index f7e5f67..62253c8 100644
--- a/compiler/basicTypes/Var.lhs
+++ b/compiler/basicTypes/Var.lhs
@@ -206,16 +206,16 @@ After CoreTidy, top-level LocalIds are turned into GlobalIds
 
 \begin{code}
 instance Outputable Var where
-  ppr var = ppr (varName var) <+> ifPprDebug (brackets (ppr_debug var))
--- Printing the type on every occurrence is too much!
---            <+> if (not (gopt Opt_SuppressVarKinds dflags))
---                then ifPprDebug (text "::" <+> ppr (tyVarKind var) <+> text ")")
---                else empty
-
-ppr_debug :: Var -> SDoc
-ppr_debug (TyVar {})                           = ptext (sLit "tv")
-ppr_debug (TcTyVar {tc_tv_details = d})        = pprTcTyVarDetails d
-ppr_debug (Id { idScope = s, id_details = d }) = ppr_id_scope s <> pprIdDetails d
+  ppr var = ppr (varName var) <> getPprStyle (ppr_debug var)
+
+ppr_debug :: Var -> PprStyle -> SDoc
+ppr_debug (TyVar {}) sty 
+  | debugStyle sty = brackets (ptext (sLit "tv"))
+ppr_debug (TcTyVar {tc_tv_details = d}) sty
+  | dumpStyle sty || debugStyle sty = brackets (pprTcTyVarDetails d)
+ppr_debug (Id { idScope = s, id_details = d }) sty
+  | debugStyle sty = brackets (ppr_id_scope s <> pprIdDetails d)
+ppr_debug _ _ = empty
 
 ppr_id_scope :: IdScope -> SDoc
 ppr_id_scope GlobalId              = ptext (sLit "gid")



More information about the ghc-commits mailing list