[commit: ghc] master: Improve pretty-printing of UnivCo (b3ee37c)

git at git.haskell.org git at git.haskell.org
Thu Jan 21 10:08:36 UTC 2016


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

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

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

commit b3ee37ce2b4ebde0f0e5574e2e50b2177bddf361
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Jan 20 14:10:08 2016 +0000

    Improve pretty-printing of UnivCo
    
    We really need to know the UnivCoProvenance to make sense
    of UnivCos in debug output


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

b3ee37ce2b4ebde0f0e5574e2e50b2177bddf361
 compiler/types/Coercion.hs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/compiler/types/Coercion.hs b/compiler/types/Coercion.hs
index 97fa211..c6a7845 100644
--- a/compiler/types/Coercion.hs
+++ b/compiler/types/Coercion.hs
@@ -227,12 +227,18 @@ ppr_co p (InstCo co arg) = maybeParen p TyConPrec $
 ppr_co p (UnivCo UnsafeCoerceProv r ty1 ty2)
   = pprPrefixApp p (text "UnsafeCo" <+> ppr r)
                    [pprParendType ty1, pprParendType ty2]
-ppr_co _ (UnivCo p r t1 t2)= angleBrackets ( ppr t1 <> comma <+> ppr t2 ) <> ppr_role r <> ppr_prov
+ppr_co _ (UnivCo p r t1 t2)
+  = char 'U'
+    <> parens (ppr_prov <> comma <+> ppr t1 <> comma <+> ppr t2)
+    <> ppr_role r
   where
     ppr_prov = case p of
-      HoleProv h          -> ppr h
-      PhantomProv kind_co -> braces (ppr kind_co)
-      _                   -> empty
+      HoleProv h          -> text "hole:"   <> ppr h
+      PhantomProv kind_co -> text "phant:"  <> ppr kind_co
+      ProofIrrelProv co   -> text "irrel:"  <> ppr co
+      PluginProv s        -> text "plugin:" <> text s
+      UnsafeCoerceProv    -> text "unsafe"
+
 ppr_co p (SymCo co)          = pprPrefixApp p (text "Sym") [pprParendCo co]
 ppr_co p (NthCo n co)        = pprPrefixApp p (text "Nth:" <> int n) [pprParendCo co]
 ppr_co p (LRCo sel co)       = pprPrefixApp p (ppr sel) [pprParendCo co]



More information about the ghc-commits mailing list