[commit: ghc] master: Imrpove comments about equality types (21970de)

git at git.haskell.org git at git.haskell.org
Wed Nov 8 11:18:22 UTC 2017


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

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

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

commit 21970de8bf810970a9f4d634d53ea02b2cb248db
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Nov 8 08:23:53 2017 +0000

    Imrpove comments about equality types


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

21970de8bf810970a9f4d634d53ea02b2cb248db
 compiler/prelude/TysPrim.hs    | 25 ++++++++++++++-----------
 compiler/prelude/TysWiredIn.hs |  2 +-
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index 5c099e8..f7a51a5 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 2033fcf..32c6117 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



More information about the ghc-commits mailing list