X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2Fprelude%2FTysPrim.lhs;h=4c70bcb7452d30d018b7fe950cf43d10bbac81c8;hp=4b3492b2c0a419b149ea4cf1c7f0f44a413d9a37;hb=b2524b3960999fffdb3767900f58825903f6560f;hpb=fdf8656855d26105ff36bdd24d41827b05037b91 diff --git a/compiler/prelude/TysPrim.lhs b/compiler/prelude/TysPrim.lhs index 4b3492b..4c70bcb 100644 --- a/compiler/prelude/TysPrim.lhs +++ b/compiler/prelude/TysPrim.lhs @@ -10,7 +10,7 @@ -- They are all, therefore, wired-in TyCons. C.f module TysWiredIn module TysPrim( alphaTyVars, betaTyVars, alphaTyVar, betaTyVar, gammaTyVar, deltaTyVar, - alphaTy, betaTy, gammaTy, deltaTy, + alphaTy, betaTy, gammaTy, deltaTy, ecTyVars, openAlphaTy, openBetaTy, openAlphaTyVar, openBetaTyVar, openAlphaTyVars, argAlphaTy, argAlphaTyVar, argBetaTy, argBetaTyVar, @@ -74,6 +74,8 @@ import Name ( Name, BuiltInSyntax(..), mkInternalName, mkWiredInName ) import OccName ( mkTcOcc,mkTyVarOccFS, mkTcOccFS ) import TyCon import TypeRep +import Type +import Coercion import SrcLoc import Unique ( mkAlphaTyVarUnique ) import PrelNames @@ -175,6 +177,9 @@ tyVarList kind = [ mkTyVar (mkInternalName (mkAlphaTyVarUnique u) where c = chr (u-2 + ord 'a') ] +ecTyVars :: [TyVar] +ecTyVars = tyVarList ecKind + alphaTyVars :: [TyVar] alphaTyVars = tyVarList liftedTypeKind @@ -379,6 +384,22 @@ doublePrimTyCon = pcPrimTyCon0 doublePrimTyConName DoubleRep %* * %************************************************************************ +Note [The (~) TyCon) +~~~~~~~~~~~~~~~~~~~~ +There is a perfectly ordinary type constructor (~) that represents the type +of coercions (which, remember, are values). For example + Refl Int :: Int ~ Int + +Atcually it is not quite "perfectly ordinary" because it is kind-polymorphic: + Refl Maybe :: Maybe ~ Maybe + +So the true kind of (~) :: forall k. k -> k -> #. But we don't have +polymorphic kinds (yet). However, (~) really only appears saturated in +which case there is no problem in finding the kind of (ty1 ~ ty2). So +we check that in CoreLint (and, in an assertion, in Kind.typeKind). + +Note [The State# TyCon] +~~~~~~~~~~~~~~~~~~~~~~~ State# is the primitive, unlifted type of states. It has one type parameter, thus State# RealWorld @@ -392,10 +413,11 @@ keep different state threads separate. It is represented by nothing at all. mkStatePrimTy :: Type -> Type mkStatePrimTy ty = mkTyConApp statePrimTyCon [ty] -statePrimTyCon :: TyCon +statePrimTyCon :: TyCon -- See Note [The State# TyCon] statePrimTyCon = pcPrimTyCon statePrimTyConName 1 VoidRep eqPredPrimTyCon :: TyCon -- The representation type for equality predicates + -- See Note [The (~) TyCon] eqPredPrimTyCon = pcPrimTyCon eqPredPrimTyConName 2 VoidRep \end{code} @@ -415,7 +437,6 @@ realWorldStatePrimTy = mkStatePrimTy realWorldTy -- State# RealWorld Note: the ``state-pairing'' types are not truly primitive, so they are defined in \tr{TysWiredIn.lhs}, not here. - %************************************************************************ %* * \subsection[TysPrim-arrays]{The primitive array types}