X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fprelude%2FTysPrim.lhs;h=3490a827ea56512dd2a4af2949c90c19ef61151e;hb=9abe297285fe213ccd804f47d253055797cf667a;hp=18c80a456e97d7f1dd84129cf9a26158c6cfd679;hpb=b06d623b2e367a572de5daf06d6a0b12c2740471;p=ghc-hetmet.git diff --git a/compiler/prelude/TysPrim.lhs b/compiler/prelude/TysPrim.lhs index 18c80a4..3490a82 100644 --- a/compiler/prelude/TysPrim.lhs +++ b/compiler/prelude/TysPrim.lhs @@ -46,7 +46,7 @@ module TysPrim( word64PrimTyCon, word64PrimTy, -- * Any - anyTyCon, anyType, anyTyConOfKind, anyTypeOfKind + anyTyCon, anyTyConOfKind, anyTypeOfKind ) where #include "HsVersions.h" @@ -233,8 +233,13 @@ Note [Uniques of Any] Although Any(*->*), say, doesn't have a binding site, it still needs to have a Unique. Unlike tuples (which are also an infinite family) there is no convenient way to index them, so we use the Unique from -their OccName instead. That should be unique! (But in principle we -must take care: it does not include the module/package.) +their OccName instead. That should be unique, + - both wrt each other, because their strings differ + + - and wrt any other Name, because Names get uniques with + various 'char' tags, but the OccName of Any will + get a Unique built with mkTcOccUnique, which has a particular 'char' + tag; see Unique.mkTcOccUnique! Note [Strangely-kinded void TyCons] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -263,22 +268,14 @@ anyTyConName = mkPrimTc (fsLit "Any") anyTyConKey anyTyCon anyTyCon :: TyCon anyTyCon = mkLiftedPrimTyCon anyTyConName liftedTypeKind 0 PtrRep -anyType :: Type -anyType = mkTyConApp anyTyCon [] - anyTypeOfKind :: Kind -> Type -anyTypeOfKind kind - | isLiftedTypeKind kind = anyType - | otherwise = mkTyConApp (mk_any_tycon kind) [] +anyTypeOfKind kind = mkTyConApp (anyTyConOfKind kind) [] anyTyConOfKind :: Kind -> TyCon +-- Map all superkinds of liftedTypeKind to liftedTypeKind anyTyConOfKind kind - | isLiftedTypeKind kind = anyTyCon - | otherwise = mk_any_tycon kind - -mk_any_tycon :: Kind -> TyCon -mk_any_tycon kind -- Kind other than * - = tycon + | liftedTypeKind `isSubKind` kind = anyTyCon + | otherwise = tycon where -- Derive the name from the kind, thus: -- Any(*->*), Any(*->*->*)