Skip to content

Simplify eta-expansion

For eta-expansion, in GHC.Core.Opt.Arity, we have

data EtaInfo            -- Abstraction      Application
  = EtaVar Var          -- /\a. []         [] a
                        -- (\x. [])        [] x
  | EtaCo CoercionR     -- [] |> sym co    [] |> co

and we work with [EtaInfo]. That describes an interleaved bunch of lambdas and casts.

But that's unnecessarily complicated. We can instead work with a single cast at the outside

data EtaInfo = EI [Var] MCoercionR

and work with simply EtaInfo.

I can't quite remember why this seemed of pressing importance, but it turns out to simplify the eta-expansion mechanism anyway. It originally arose when I was working on #19790 (closed) .

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