Note [CorePrepEnv: cpe_subst]
CorePrepEnv carries a substitution `Subst` in the `cpe_subst1 field, for these reasons: 1. To support cloning of local Ids so that they are all unique (see Note [Cloning in CorePrep]) 2. To support beta-reduction of runRW, see Note [runRW magic] and Note [runRW arg]. 3. To let us inline trivial RHSs of non top-level let-bindings, see Note [lazyId magic], Note [Inlining in CorePrep] (#12076) Note that, if (y::forall a. a->a), we could get x = lazy @(forall a.a) y @Bool so after eliminating `lazy`, we need to replace occurrences of `x` with `y @Bool`, not just `y`. Situations like this can easily arise with higher-rank types; thus, `cpe_subst` must map to CoreExprs, not Ids, which oc course it does 4. The TyCoVar part of the substitution is used only for Note [Cloning CoVars and TyVars]
References 6
- Cloning CoVars and TyVars GHC.CoreToStg.Prep
- Cloning in CorePrep GHC.CoreToStg.Prep
- Inlining in CorePrep GHC.CoreToStg.Prep
- runRW arg GHC.CoreToStg.Prep
- runRW magic GHC.CoreToStg.Prep
- lazyId magic GHC.Types.Id.Make
Referenced by 1
- GHC.CoreToStg.Prep call site