getTyVar, mkAppTy, mkUTy,
splitPredTy_maybe, splitForAllTys,
isTyVarTy, mkTyVarTy, mkTyVarTys,
- openTypeKind, boxedTypeKind,
+ openTypeKind, liftedTypeKind,
superKind, superBoxity,
- defaultKind, boxedBoxity
+ defaultKind, liftedBoxity
)
import Subst ( Subst, mkTopTyVarSubst, substTy )
import TyCon ( mkPrimTyCon )
import TysWiredIn ( voidTy )
import Name ( Name, NamedThing(..), setNameUnique, mkSysLocalName,
- mkDerivedName, mkDerivedTyConOcc
+ mkLocalName, mkDerivedTyConOcc
)
import Unique ( Uniquable(..) )
+import SrcLoc ( noSrcLoc )
import Util ( nOfThem )
import Outputable
\end{code}
-- When zonking a kind, we want to
-- zonk a *kind* variable to (Type *)
-- zonk a *boxity* variable to *
- zonk_unbound_kind_var kv | tyVarKind kv == superKind = tcPutTyVar kv boxedTypeKind
- | tyVarKind kv == superBoxity = tcPutTyVar kv boxedBoxity
+ zonk_unbound_kind_var kv | tyVarKind kv == superKind = tcPutTyVar kv liftedTypeKind
+ | tyVarKind kv == superBoxity = tcPutTyVar kv liftedBoxity
| otherwise = pprPanic "zonkKindEnv" (ppr kv)
zonkTcTypeToType :: TcType -> NF_TcM Type
zonkTcTypeToType ty = zonkType zonk_unbound_tyvar ty
where
-- Zonk a mutable but unbound type variable to
- -- Void if it has kind Boxed
+ -- Void if it has kind Lifted
-- :Void otherwise
zonk_unbound_tyvar tv
- | kind == boxedTypeKind
+ | kind == liftedTypeKind
= tcPutTyVar tv voidTy -- Just to avoid creating a new tycon in
-- this vastly common case
| otherwise
mk_void_tycon tv kind -- Make a new TyCon with the same kind as the
-- type variable tv. Same name too, apart from
-- making it start with a colon (sigh)
- = mkPrimTyCon tc_name kind 0 [] VoidRep
+ -- I dread to think what will happen if this gets out into an
+ -- interface file. Catastrophe likely. Major sigh.
+ = pprTrace "Urk! Inventing strangely-kinded void TyCon" (ppr tc_name) $
+ mkPrimTyCon tc_name kind 0 [] VoidRep
where
- tc_name = mkDerivedName mkDerivedTyConOcc (getName tv) (getUnique tv)
+ tc_name = mkLocalName (getUnique tv) (mkDerivedTyConOcc (getOccName tv)) noSrcLoc
-- zonkTcTyVarToTyVar is applied to the *binding* occurrence
-- of a type variable, at the *end* of type checking. It changes
zonkTcTyVarToTyVar tv
= let
-- Make an immutable version, defaulting
- -- the kind to boxed if necessary
+ -- the kind to lifted if necessary
immut_tv = mkTyVar (tyVarName tv) (defaultKind (tyVarKind tv))
immut_tv_ty = mkTyVarTy immut_tv