Skip to content

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:

  1. We shouldn't have more than one place that does eta-expansion
  2. mkWWargs coughs up its own weird ww-prefixed binder names
  3. mkWWargs doesn't transfer useful IdInfo such as idUnfolding. That bites us in !5641 (closed) where we have to fix mkWWargs.
  4. 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, see Note [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.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information