X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypes%2FKind.lhs;h=0e88536ad6c2733c31f090685dee1a428bdc6718;hb=339d5220bcb7e8ca344ca5ec6e862d2373267be8;hp=4c32ce15e6031a7588714eed9d8a0dbd5abb26e8;hpb=96179bddcb250a1772adc5a86d62c17125637709;p=ghc-hetmet.git diff --git a/ghc/compiler/types/Kind.lhs b/ghc/compiler/types/Kind.lhs index 4c32ce1..0e88536 100644 --- a/ghc/compiler/types/Kind.lhs +++ b/ghc/compiler/types/Kind.lhs @@ -44,9 +44,9 @@ where * [LiftedTypeKind] means boxed type In particular: - error :: forall a:. String -> a + error :: forall a:?. String -> a (->) :: ?? -> ? -> * - (\(x::t) -> ...) Here t:: (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