cvs commit: fptools/ghc/compiler/rename RnSource.lhs fptools/ghc/compiler/typecheck TcRules.lhs

Simon Peyton Jones simonpj@glass.cse.ogi.edu
Mon, 16 Sep 2002 00:31:12 -0700


simonpj     2002/09/16 00:31:12 PDT

  Modified files:
    ghc/compiler/rename  RnSource.lhs 
    ghc/compiler/typecheck TcRules.lhs 
  Log:
  	--------------------------------
     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).
  
  Revision  Changes    Path
  1.146     +2 -0      fptools/ghc/compiler/rename/RnSource.lhs
  1.39      +39 -9     fptools/ghc/compiler/typecheck/TcRules.lhs
_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc