[commit: ghc] master: Better debug-printing for Outputable TyConBinder (8834d48)

git at git.haskell.org git at git.haskell.org
Tue Aug 29 08:37:30 UTC 2017


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/8834d482614b3c4b9dd57202134a518b1771ed99/ghc

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

commit 8834d482614b3c4b9dd57202134a518b1771ed99
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Mon Aug 28 13:27:14 2017 +0100

    Better debug-printing for Outputable TyConBinder
    
    Anon and Required were printed the same :-(.  This is only for
    debug printing, so I switched to a slightly more verbose and
    explicit format


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

8834d482614b3c4b9dd57202134a518b1771ed99
 compiler/types/TyCon.hs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/compiler/types/TyCon.hs b/compiler/types/TyCon.hs
index 63e199c..6a4ff72 100644
--- a/compiler/types/TyCon.hs
+++ b/compiler/types/TyCon.hs
@@ -385,6 +385,7 @@ See also:
 -}
 
 type TyConBinder = TyVarBndr TyVar TyConBndrVis
+                   -- See also Note [TyBinder] in TyCoRep
 
 data TyConBndrVis
   = NamedTCB ArgFlag
@@ -547,10 +548,10 @@ They fit together like so:
 -}
 
 instance Outputable tv => Outputable (TyVarBndr tv TyConBndrVis) where
-  ppr (TvBndr v AnonTCB)              = ppr v
-  ppr (TvBndr v (NamedTCB Required))  = ppr v
-  ppr (TvBndr v (NamedTCB Specified)) = char '@' <> ppr v
-  ppr (TvBndr v (NamedTCB Inferred))  = braces (ppr v)
+  ppr (TvBndr v AnonTCB)              = text "anon" <+> parens (ppr v)
+  ppr (TvBndr v (NamedTCB Required))  = text "req"  <+> parens (ppr v)
+  ppr (TvBndr v (NamedTCB Specified)) = text "spec" <+> parens (ppr v)
+  ppr (TvBndr v (NamedTCB Inferred))  = text "inf"  <+> parens (ppr v)
 
 instance Binary TyConBndrVis where
   put_ bh AnonTCB        = putByte bh 0



More information about the ghc-commits mailing list