diff options
author | simonpj@microsoft.com <unknown> | 2010-10-07 10:37:00 +0000 |
---|---|---|
committer | simonpj@microsoft.com <unknown> | 2010-10-07 10:37:00 +0000 |
commit | afd6da0d938747f45b16c8d6eb5d786e59a21218 (patch) | |
tree | 25d64cc7f7f67fcfea2f68a0903c1c9c4a39fb0c /compiler/specialise | |
parent | 5c248c7dfa9b789df31ca5186c4f181f1e8eb42b (diff) | |
download | haskell-afd6da0d938747f45b16c8d6eb5d786e59a21218.tar.gz |
Improve the rule-matcher
Previously it was rejecting the match
Template: forall s t. map s t
Actual: map Int t
which should obviously be fine. It turns out that this kind of match
comes up when specialising. By freshening that t we could avoid the
difficulty, but morally the (forall t) binds t and the rule should
be alpha-equivalent regardless of the forall'd variables.
This patch makes it so, and incidentally makes matching a little
more efficient. See Note [Eta expansion] in VarEnv.
Diffstat (limited to 'compiler/specialise')
-rw-r--r-- | compiler/specialise/Rules.lhs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/specialise/Rules.lhs b/compiler/specialise/Rules.lhs index 87999a4dfd..b4b996248b 100644 --- a/compiler/specialise/Rules.lhs +++ b/compiler/specialise/Rules.lhs @@ -652,7 +652,7 @@ match idu menv subst (Lam x1 e1) (Lam x2 e2) match idu menv subst (Lam x1 e1) e2 = match idu menv' subst e1 (App e2 (varToCoreExpr new_x)) where - (rn_env', new_x) = rnBndrL (me_env menv) x1 + (rn_env', new_x) = rnEtaL (me_env menv) x1 menv' = menv { me_env = rn_env' } -- Eta expansion the other way @@ -660,7 +660,7 @@ match idu menv subst (Lam x1 e1) e2 match idu menv subst e1 (Lam x2 e2) = match idu menv' subst (App e1 (varToCoreExpr new_x)) e2 where - (rn_env', new_x) = rnBndrR (me_env menv) x2 + (rn_env', new_x) = rnEtaR (me_env menv) x2 menv' = menv { me_env = rn_env' } match idu menv subst (Case e1 x1 ty1 alts1) (Case e2 x2 ty2 alts2) |