summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-09-27 17:16:57 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2016-09-27 17:17:27 +0100
commitbfd1ac57535a9229fd55ba22369d8a159bb9392b (patch)
treec8652450b0d4c8d0f82f4db5c65981d6518bda49
parentebbb8cffc6f65ce3b37041e619ffc9309d815451 (diff)
downloadhaskell-wip/spj-temp.tar.gz
Comments onlywip/spj-temp
-rw-r--r--compiler/types/TyCoRep.hs30
1 files changed, 27 insertions, 3 deletions
diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs
index a355b850a5..50d1cba7ed 100644
--- a/compiler/types/TyCoRep.hs
+++ b/compiler/types/TyCoRep.hs
@@ -2954,6 +2954,7 @@ pprTcApp_help to_type p pp tc tys dflags style
pp_tc = ppr tc
tys_wo_kinds = suppressInvisibles to_type dflags tc tys
+ -- See Note [Printing eqauality constraints]
mb_saturated_equality
| hetero_eq_tc
, [k1, k2, t1, t2] <- tys
@@ -2964,14 +2965,13 @@ pprTcApp_help to_type p pp tc tys dflags style
| otherwise
= Nothing
+ -- See Note [Printing eqauality constraints]
homo_eq_tc = tc `hasKey` eqTyConKey -- ~
hetero_eq_tc = tc `hasKey` eqPrimTyConKey -- ~#
|| tc `hasKey` eqReprPrimTyConKey -- ~R#
|| tc `hasKey` heqTyConKey -- ~~
- -- This is all a bit ad-hoc, trying to print out the best representation
- -- of equalities. If you see a better design, go for it.
-
+ -- See Note [Printing eqauality constraints]
print_equality (ki1, ki2, ty1, ty2)
| print_eqs
= ppr_infix_eq pp_tc
@@ -2999,6 +2999,30 @@ pprTcApp_help to_type p pp tc tys dflags style
dumpStyle style ||
debugStyle style
+{- Note [Printing equality constraints]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+GHC has a lot of differnent equalities:
+ ~ Boxed homogeneous Nominal
+ ~~ Boxed heterogeneous Nominal
+ ~# Unboxed heterogeneous Nominal
+ ~R# Unboxed heterogeneous Representational
+
+This is cofusing to the user, so when priting we usse this
+strategy:
+
+If -fprint-equality-relations or -dppr-debug or we are in
+ "dump style", then print the relation as-is, which
+ distinguishes the various different equalities listed
+ above
+
+If ...something about heterogeneous equalities
+
+Ohherwise print 'Coercible' for (~#), and "~" for the others.
+
+This is all a bit ad-hoc, trying to print out the best representation
+of equalities. If you see a better design, go for it.
+-}
+
------------------
-- | Given a 'TyCon',and the args to which it is applied,
-- suppress the args that are implicit