Make RULE matching insensitive to eta-expansion
This is a new MR for #19790 (closed), focusing just on RULES
This patch fixes #19790 (closed) by making the rule matcher do on-the-fly
eta reduction. See Note [Eta reduction the target]
in GHC.Core.Rules
Other things in here
-
I found I also had to careful about casts when matching; see
Note [Casts in the target]
andNote [Casts in the template]
-
I made eta-reduction conditional on
sm_eta_expand
, in GHC.Core.Opt.Simplify.Utils.mkLam; reasons explained in Note [Casts and lambdas] in that module. -
Lots more comments and Notes in the rule matcher