Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2002-09-16 07:31:11 by simonpj] · deafae58
    Simon Peyton Jones authored
    --------------------------------
       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).
    deafae58