From 7676e57a3a0868448cad6e52aa1e69ef2d76158c Mon Sep 17 00:00:00 2001 From: Manuel M T Chakravarty Date: Wed, 20 Sep 2006 18:27:08 +0000 Subject: [PATCH] Small refactoring Mon Sep 18 17:41:37 EDT 2006 Manuel M T Chakravarty * Small refactoring Wed Aug 9 04:41:54 EDT 2006 simonpj@microsoft.com * Small refactoring --- compiler/coreSyn/CoreUtils.lhs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs index 24d4d02..0cc6003 100644 --- a/compiler/coreSyn/CoreUtils.lhs +++ b/compiler/coreSyn/CoreUtils.lhs @@ -73,7 +73,7 @@ import Type ( Type, mkFunTy, mkForAllTy, splitFunTy_maybe, applyTys, isUnLiftedType, seqType, mkTyVarTy, splitForAllTy_maybe, isForAllTy, splitTyConApp_maybe, coreEqType, funResultTy, applyTy, - substTyWith, mkPredTy + substTyWith, mkPredTy, zipOpenTvSubst, substTy ) import Coercion ( Coercion, mkTransCoercion, coercionKind, splitNewTypeRepCo_maybe, mkSymCoercion, @@ -742,27 +742,25 @@ dataConInstPat arg_fun fss uniqs con inst_tys (ex_fss, fss') = splitAt n_ex fss (co_fss, id_fss) = splitAt n_co fss' - -- make existential type variables + -- Make existential type variables + ex_bndrs = zipWith3 mk_ex_var ex_uniqs ex_fss ex_tvs mk_ex_var uniq fs var = mkTyVar new_name kind where new_name = mkSysTvName uniq fs kind = tyVarKind var - ex_bndrs = zipWith3 mk_ex_var ex_uniqs ex_fss ex_tvs - - -- make the instantiation substitution - inst_subst = substTyWith (univ_tvs ++ ex_tvs) (inst_tys ++ map mkTyVarTy ex_bndrs) + -- Make the instantiating substitution + subst = zipOpenTvSubst (univ_tvs ++ ex_tvs) (inst_tys ++ map mkTyVarTy ex_bndrs) - -- make new coercion vars, instantiating kind + -- Make new coercion vars, instantiating kind + co_bndrs = zipWith3 mk_co_var co_uniqs co_fss eq_preds mk_co_var uniq fs eq_pred = mkCoVar new_name co_kind where new_name = mkSysTvName uniq fs - co_kind = inst_subst (mkPredTy eq_pred) - - co_bndrs = zipWith3 mk_co_var co_uniqs co_fss eq_preds + co_kind = substTy subst (mkPredTy eq_pred) -- make value vars, instantiating types - mk_id_var uniq fs ty = mkUserLocal (mkVarOccFS fs) uniq (inst_subst ty) noSrcLoc + mk_id_var uniq fs ty = mkUserLocal (mkVarOccFS fs) uniq (substTy subst ty) noSrcLoc id_bndrs = zipWith3 mk_id_var id_uniqs id_fss arg_tys exprIsConApp_maybe :: CoreExpr -> Maybe (DataCon, [CoreExpr]) -- 1.7.10.4