Simplifier: Insufficient eta expansion of arguments
While hunting regressions in !9874 I found that T21839r
regressed by 10%. I realised that the argument in the following program is not properly eta-expanded:
g :: ((Integer -> Integer) -> Integer) -> (Integer -> Integer) -> Integer
g f h = f (h `seq` (h $))
After simplification, we have
g = \ (f_aiR :: (Integer -> Integer) -> Integer)
(h_aiS :: Integer -> Integer) ->
f_aiR
(case h_aiS of h1_X0 { __DEFAULT ->
$ @GHC.Types.LiftedRep @Integer @Integer h1_X0
})
It would be much better to eta-expand the Case expression and subsequently inline $
.
I believe is this due to the Simplifier never checking whether it can eta-expand an argument.