diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2021-05-04 08:29:21 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-01-26 19:45:22 -0500 |
commit | 590a2918d815edd184a1665e361640a29674cbf3 (patch) | |
tree | d1d6914f8f006b9fe164192e5cd8119584200725 /compiler/GHC/Tc | |
parent | e840582943eaa49e739fc9d801d2f0925daac0a0 (diff) | |
download | haskell-590a2918d815edd184a1665e361640a29674cbf3.tar.gz |
Make RULE matching insensitive to eta-expansion
This patch fixes #19790 by making the rule matcher do on-the-fly
eta reduction. See Note [Eta reduction the target] in GHC.Core.Rules
I found I also had to careful about casts when matching; see
Note [Casts in the target] and Note [Casts in the template]
Lots more comments and Notes in the rule matcher
Diffstat (limited to 'compiler/GHC/Tc')
-rw-r--r-- | compiler/GHC/Tc/Gen/Rule.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/GHC/Tc/Gen/Rule.hs b/compiler/GHC/Tc/Gen/Rule.hs index 10dffa2648..40e4d55ecf 100644 --- a/compiler/GHC/Tc/Gen/Rule.hs +++ b/compiler/GHC/Tc/Gen/Rule.hs @@ -134,7 +134,7 @@ tcRule (HsRule { rd_ext = ext ; (lhs_evs, residual_lhs_wanted) <- simplifyRule name tc_lvl lhs_wanted rhs_wanted - -- SimplfyRule Plan, step 4 + -- SimplifyRule Plan, step 4 -- Now figure out what to quantify over -- c.f. GHC.Tc.Solver.simplifyInfer -- We quantify over any tyvars free in *either* the rule @@ -306,8 +306,9 @@ revert to SimplCheck when going under an implication. * Step 0: typecheck the LHS and RHS to get constraints from each -* Step 1: Simplify the LHS and RHS constraints all together in one bag - We do this to discover all unification equalities +* Step 1: Simplify the LHS and RHS constraints all together in one bag, + but /discarding/ the simplified constraints. We do this only + to discover all unification equalities. * Step 2: Zonk the ORIGINAL (unsimplified) LHS constraints, to take advantage of those unifications |