summaryrefslogtreecommitdiff
path: root/compiler/prelude
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2017-11-08 08:23:53 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2017-11-08 11:12:33 +0000
commit21970de8bf810970a9f4d634d53ea02b2cb248db (patch)
tree4b60aad3e3f0e11797f2a6f9ef2890de09e0a5aa /compiler/prelude
parent14d885e843f6907dbc5048ae66aca25d738e99f7 (diff)
downloadhaskell-21970de8bf810970a9f4d634d53ea02b2cb248db.tar.gz
Imrpove comments about equality types
Diffstat (limited to 'compiler/prelude')
-rw-r--r--compiler/prelude/TysPrim.hs25
-rw-r--r--compiler/prelude/TysWiredIn.hs2
2 files changed, 15 insertions, 12 deletions
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index 5c099e845e..f7a51a535e 100644
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -582,17 +582,19 @@ Note [The equality types story]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GHC sports a veritable menagerie of equality types:
- Built-in tc Hetero? Levity Result Role Defining module
+ Type or Lifted? Hetero? Role Built in Defining module
+ class? L/U TyCon
-----------------------------------------------------------------------------------------
-~# eqPrimTyCon hetero unlifted # nominal GHC.Prim
-~~ hEqTyCon hetero lifted Constraint nominal GHC.Types
-~ eqTyCon homo lifted Constraint nominal Data.Type.Equality
-:~: - homo lifted * nominal Data.Type.Equality
+~# T U hetero nominal eqPrimTyCon GHC.Prim
+~~ C L hetero nominal hEqTyCon GHC.Types
+~ C L homo nominal eqTyCon Data.Type.Equality
+:~: T L homo nominal (not built-in) Data.Type.Equality
+:~~: T L hetero nominal (not built-in) Data.Type.Equality
-~R# eqReprPrimTy hetero unlifted # repr GHC.Prim
-Coercible coercibleTyCon homo lifted Constraint repr GHC.Types
-Coercion - homo lifted * repr Data.Type.Coercion
-~P# eqPhantPrimTyCon hetero unlifted phantom GHC.Prim
+~R# T U hetero repr eqReprPrimTy GHC.Prim
+Coercible C L homo repr coercibleTyCon GHC.Types
+Coercion T L homo repr (not built-in) Data.Type.Coercion
+~P# T U hetero phantom eqPhantPrimTyCon GHC.Prim
Recall that "hetero" means the equality can related types of different
kinds. Knowing that (t1 ~# t2) or (t1 ~R# t2) or even that (t1 ~P# t2)
@@ -676,9 +678,10 @@ it is *not* wired in.
--------------------------
(:~:) :: forall k. k -> k -> *
+ (:~~:) :: forall k1 k2. k1 -> k2 -> *
--------------------------
-This is a perfectly ordinary GADT, wrapping (~). It is not defined within
-GHC at all.
+These are perfectly ordinary GADTs, wrapping (~) and (~~) resp.
+They are not defined within GHC at all.
--------------------------
diff --git a/compiler/prelude/TysWiredIn.hs b/compiler/prelude/TysWiredIn.hs
index 2033fcff36..32c6117041 100644
--- a/compiler/prelude/TysWiredIn.hs
+++ b/compiler/prelude/TysWiredIn.hs
@@ -1009,7 +1009,7 @@ mk_sum arity = (tycon, sum_cons)
********************************************************************* -}
-- See Note [The equality types story] in TysPrim
--- (:~~: :: forall k1 k2 (a :: k1) (b :: k2). a -> b -> Constraint)
+-- ((~~) :: forall k1 k2 (a :: k1) (b :: k2). a -> b -> Constraint)
--
-- It's tempting to put functional dependencies on (~~), but it's not
-- necessary because the functional-dependency coverage check looks