Note [Which RHSs do we eta-expand?]
We don't eta-expand:
* Trivial RHSs, e.g. f = g
If we eta expand do
f = \x. g x
we'll just eta-reduce again, and so on; so the
simplifier never terminates.
* PAPs: see Note [Do not eta-expand PAPs]
What about things like this?
f = case y of p -> \x -> blah
Here we do eta-expand. This is a change (Jun 20), but if we have
really decided that f has arity 1, then putting that lambda at the top
seems like a Good idea. References 1
- Do not eta-expand PAPs GHC.Core.Opt.Simplify.Utils
Referenced by 2
- Eta-expand stable unfoldings GHC.Core.Opt.Simplify.Iteration
- GHC.Core.Opt.Simplify.Utils call site