cvs commit: fptools/ghc/compiler/typecheck TcSimplify.lhs

Simon Peyton Jones simonpj@glass.cse.ogi.edu
Wed, 28 Feb 2001 09:17:56 -0800


simonpj     2001/02/28 09:17:55 PST

  Modified files:
    ghc/compiler/typecheck TcSimplify.lhs 
  Log:
  	Improve rule matching
  
  When doing constraint simplification on the LHS of a rule,
  we *don't* want to do superclass commoning up.  Consider
  
  	fromIntegral :: (Integral a, Num b) => a -> b
  	{-# RULES "foo"  fromIntegral = id :: Int -> Int #-}
  
  Here, a=b=Int, and Num Int is a superclass of Integral Int. But we *dont*
  want to get
  
  	forall dIntegralInt.
  	fromIntegral Int Int dIntegralInt (scsel dIntegralInt) = id Int
  
  because the scsel (super class selection) will mess up matching.
  Instead we want
  
  	forall dIntegralInt, dNumInt.
  	fromIntegral Int Int dIntegralInt dNumInt = id Int
  
  TcSimplify.tcSimplifyToDicts is the relevant function, but I had
  to generalise the main simplification loop a little (adding the
  type WantSCs).
  
  Revision  Changes    Path
  1.69      +60 -43    fptools/ghc/compiler/typecheck/TcSimplify.lhs