- subst = mkTopTvSubst eq_spec
- famSubst = ASSERT( length (tyConTyVars tycon ) ==
- length (mkTyVarTys univ_tvs) )
- zipTopTvSubst (tyConTyVars tycon) (mkTyVarTys univ_tvs)
- -- substitution mapping the type constructor's type
- -- arguments to the universals of the data constructor
- -- (crucial when type checking interfaces)
- dict_tys = mkPredTys theta
- result_ty_args = substTyVars subst univ_tvs
- result_ty = case tyConFamInst_maybe tycon of
- -- ordinary constructor
- Nothing -> mkTyConApp tycon result_ty_args
- -- family instance constructor
- Just (familyTyCon,
- instTys) ->
- mkTyConApp familyTyCon ( substTys subst
- . substTys famSubst
- $ instTys)
- wrap_ty = mkForAllTys wrap_tvs $ mkFunTys dict_tys $
- mkFunTys orig_arg_tys $ result_ty
+ dict_tys = mkPredTys theta
+ wrap_ty = mkForAllTys wrap_tvs $ mkFunTys dict_tys $
+ mkFunTys orig_arg_tys $ res_ty