Note [Arity robustness]
We *do* transfer the arity from the in_id of a let binding to the
out_id so that its arity is visible in its RHS. Examples:
* f = \x y. let g = \p q. f (p+q) in Just (...g..g...)
Here we want to give `g` arity 3 and eta-expand. `findRhsArity` will have a
hard time figuring that out when `f` only has arity 0 in its own RHS.
* f = \x y. ....(f `seq` blah)....
We want to drop the seq.
* f = \x. g (\y. f y)
You'd think we could eta-reduce `\y. f y` to `f` here. And indeed, that is true.
Unfortunately, it is not sound in general to eta-reduce in f's RHS.
Example: `f = \x. f x`. See Note [Eta reduction in recursive RHSs] for how
we prevent that. References 1
- Eta reduction in recursive RHSs GHC.Core.Opt.Arity
Referenced by 2
- Eta reduction soundness GHC.Core.Opt.Arity
- GHC.Core.Opt.Simplify.Env call site