[project @ 2002-09-16 07:31:11 by simonpj]
authorsimonpj <unknown>
Mon, 16 Sep 2002 07:31:12 +0000 (07:31 +0000)
committersimonpj <unknown>
Mon, 16 Sep 2002 07:31:12 +0000 (07:31 +0000)
commitdeafae587c0ee3b0fc005e2f5e654649aa27596b
tree06ccc317e18e90dfb752433b7c7efcfde64a4394
parent55fed3324a1eede60603c6960c368e8fbac23e19
[project @ 2002-09-16 07:31:11 by simonpj]
--------------------------------
   Quantify over unbound type vars in RULE lhs's
--------------------------------

-- We need to gather the type variables mentioned on the LHS so we can
-- quantify over them.  Example:
--   data T a = C
--
--   foo :: T a -> Int
--   foo C = 1
--
--   {-# RULES "myrule"  foo C = 1 #-}
--
-- After type checking the LHS becomes (foo a (C a))
-- and we do not want to zap the unbound tyvar 'a' to (), because
-- that limits the applicability of the rule.  Instead, we
-- want to quantify over it!

This commit fixes the problem, discovered by Manuel.  It uses a
free-variable finder for RULE lhs's (TcRule.ruleLhsTvs) which relies
on the fact that the LHS of a rule can only take ver forms
(c.f RnSource.validRuleLhs).
ghc/compiler/rename/RnSource.lhs
ghc/compiler/typecheck/TcRules.lhs