[commit: ghc] master: Comments about AnyK (2d68aa6)

git at git.haskell.org git at git.haskell.org
Thu Apr 9 16:36:42 UTC 2015


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

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

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

commit 2d68aa650b2c47e011aaa7e51227491c3f1e9866
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Thu Apr 9 15:02:08 2015 +0100

    Comments about AnyK


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

2d68aa650b2c47e011aaa7e51227491c3f1e9866
 compiler/prelude/TysPrim.hs | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index b1007e0..19c64ef 100644
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -728,16 +728,20 @@ The type constructor Any of kind forall k. k has these properties:
 
 Note [Any kinds]
 ~~~~~~~~~~~~~~~~
-
 The type constructor AnyK (of sort BOX) is used internally only to zonk kind
 variables with no constraints on them. It appears in similar circumstances to
 Any, but at the kind level. For example:
 
   type family Length (l :: [k]) :: Nat
-  type instance Length [] = Zero
 
-Length is kind-polymorphic, and when applied to the empty (promoted) list it
-will have the kind Length AnyK [].
+  f :: Proxy (Length []) -> Int
+  f = ....
+
+Length is kind-polymorphic.  So what is the elaborated type of f?
+   f :: Proxy (Length AnyK ([] AnyK)) -> Int
+
+Just like (length []) at the term level, which elaborates to
+   length (Any *) ([] (Any *))
 
 Note [Strangely-kinded void TyCons]
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the ghc-commits mailing list