X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Ftypecheck%2FTcType.lhs;h=72d4eb74bf3d35aad0931fbe9c8ac0eba7392374;hb=69e14f75a4b031e489b7774914e5a176409cea78;hp=48d58fe7584238b60c65c0d964214455665c07d0;hpb=d133b73a4d4717892ced072d05e039a54ede0ceb;p=ghc-hetmet.git diff --git a/ghc/compiler/typecheck/TcType.lhs b/ghc/compiler/typecheck/TcType.lhs index 48d58fe..72d4eb7 100644 --- a/ghc/compiler/typecheck/TcType.lhs +++ b/ghc/compiler/typecheck/TcType.lhs @@ -56,9 +56,9 @@ import Type ( Type(..), Kind, ThetaType, TyNote(..), mkAppTy, mkTyConApp, splitDictTy_maybe, splitForAllTys, isNotUsgTy, isTyVarTy, mkTyVarTy, mkTyVarTys, - fullSubstTy, substTopTy, typeCon, openTypeKind, boxedTypeKind, boxedKind, superKind, superBoxity ) +import Subst ( Subst, mkTopTyVarSubst, substTy ) import TyCon ( tyConKind, mkPrimTyCon ) import PrimRep ( PrimRep(VoidRep) ) import VarEnv @@ -170,14 +170,17 @@ Instantiating a bunch of type variables \begin{code} tcInstTyVars :: [TyVar] - -> NF_TcM s ([TcTyVar], [TcType], TyVarEnv TcType) + -> NF_TcM s ([TcTyVar], [TcType], Subst) tcInstTyVars tyvars = mapNF_Tc tcInstTyVar tyvars `thenNF_Tc` \ tc_tyvars -> let tys = mkTyVarTys tc_tyvars in - returnNF_Tc (tc_tyvars, tys, zipVarEnv tyvars tys) + returnNF_Tc (tc_tyvars, tys, mkTopTyVarSubst tyvars tys) + -- Since the tyvars are freshly made, + -- they cannot possibly be captured by + -- any existing for-alls. Hence mkTopTyVarSubst tcInstTyVar tyvar = tcGetUnique `thenNF_Tc` \ uniq -> @@ -229,10 +232,7 @@ tcInstTcType ty = case splitForAllTys ty of ([], _) -> returnNF_Tc ([], ty) -- Nothing to do (tyvars, rho) -> tcInstTyVars tyvars `thenNF_Tc` \ (tyvars', _, tenv) -> - returnNF_Tc (tyvars', fullSubstTy tenv emptyVarSet rho) - -- Since the tyvars are freshly made, - -- they cannot possibly be captured by - -- any existing for-alls. Hence emptyVarSet + returnNF_Tc (tyvars', substTy tenv rho) \end{code}