WorkWrap: mkWWargs should do eta-expansion through GHC.Core.Opt.Arity
GHC.Core.Opt.WorkWrap.Utils.mkWWargs
does some funny kind of eta-expansion transformation that predates GHC.Core.Opt.Arity.etaExpand
by a lot. I have several issues with it:
- We shouldn't have more than one place that does eta-expansion
-
mkWWargs
coughs up its own weirdww
-prefixed binder names -
mkWWargs
doesn't transfer usefulIdInfo
such asidUnfolding
. That bites us in !5641 (closed) where we have to fixmkWWargs
. - It's unclear to me why w/w does eta-expansion at all: If the function doesn't have the "right arity" (which according to what
mkWWargs
believes is the number of arg demands), it shouldn't be transformed in the first place! In fact, we make already make sure that we don't get into such a situation, seeNote [Don't eta expand in w/w]
in GHC.Core.Opt.WorkWrap.
I've no idea why we even need that code anymore. If we need it, it should better call GHC.Core.Opt.Arity.etaExpand
.