• simonpj's avatar
    [project @ 2001-02-28 17:17:55 by simonpj] · 56d75e0b
    simonpj authored
    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).
    56d75e0b
TcSimplify.lhs 51.5 KB