Improve the rule-matcher
authorsimonpj@microsoft.com <unknown>
Thu, 7 Oct 2010 10:37:00 +0000 (10:37 +0000)
committersimonpj@microsoft.com <unknown>
Thu, 7 Oct 2010 10:37:00 +0000 (10:37 +0000)
commitafd6da0d938747f45b16c8d6eb5d786e59a21218
tree25d64cc7f7f67fcfea2f68a0903c1c9c4a39fb0c
parent5c248c7dfa9b789df31ca5186c4f181f1e8eb42b
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.
compiler/basicTypes/VarEnv.lhs
compiler/specialise/Rules.lhs