diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2014-10-29 15:15:38 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2014-11-04 10:37:54 +0000 |
commit | 27ba070c56fa6c583a34dc9eaede0083530f1dbe (patch) | |
tree | 6b1726e855200c3880bf73e82caa1f9d6b06b1bc | |
parent | 1d6124de4e7ee97447e9e2fff6beca617b4d694b (diff) | |
download | haskell-27ba070c56fa6c583a34dc9eaede0083530f1dbe.tar.gz |
Improve pretty-printing of type variables
In particular, print a bit of debug info in debug-style and dump-style
Otherwise distinct type variables look the same
-rw-r--r-- | compiler/basicTypes/Var.lhs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/compiler/basicTypes/Var.lhs b/compiler/basicTypes/Var.lhs index f7e5f6752a..62253c8642 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") |