[project @ 2004-12-24 16:14:36 by simonpj]
[ghc-hetmet.git] / ghc / compiler / types / Kind.lhs
index 4c32ce1..0e88536 100644 (file)
@@ -44,9 +44,9 @@ where *    [LiftedTypeKind]   means boxed type
 
 In particular:
 
-       error :: forall a:<any>. String -> a
+       error :: forall a:?. String -> a
        (->)  :: ?? -> ? -> *
-       (\(x::t) -> ...)        Here t::<any> (i.e. not unboxed tuple)
+       (\(x::t) -> ...)        Here t::?? (i.e. not unboxed tuple)
 
 \begin{code}
 data Kind 
@@ -97,11 +97,6 @@ finding the GLB of the two.  Since the partial order is a tree, they only
 have a glb if one is a sub-kind of the other.  In that case, we bind the
 less-informative one to the more informative one.  Neat, eh?
 
-In the olden days, when we generalise, we make generic type variables
-whose kind is simple.  So generic type variables (other than built-in
-constants like 'error') always have simple kinds.  But I don't see any
-reason to do that any more (TcMType.zapTcTyVarToTyVar).
-
 
 \begin{code}
 liftedTypeKind   = LiftedTypeKind
@@ -165,6 +160,18 @@ isSubKind k1 k2 = False
 
 defaultKind :: Kind -> Kind
 -- Used when generalising: default kind '?' and '??' to '*'
+-- 
+-- When we generalise, we make generic type variables whose kind is
+-- simple (* or *->* etc).  So generic type variables (other than
+-- built-in constants like 'error') always have simple kinds.  This is important;
+-- consider
+--     f x = True
+-- We want f to get type
+--     f :: forall (a::*). a -> Bool
+-- Not 
+--     f :: forall (a::??). a -> Bool
+-- because that would allow a call like (f 3#) as well as (f True),
+--and the calling conventions differ.  This defaulting is done in TcMType.zonkTcTyVarBndr.
 defaultKind OpenTypeKind = LiftedTypeKind
 defaultKind ArgTypeKind  = LiftedTypeKind
 defaultKind kind        = kind