[project @ 2001-02-28 17:17:55 by simonpj]
authorsimonpj <unknown>
Wed, 28 Feb 2001 17:17:55 +0000 (17:17 +0000)
committersimonpj <unknown>
Wed, 28 Feb 2001 17:17:55 +0000 (17:17 +0000)
commit56d75e0bcd599a167deb7ef10dfb8b18b6529940
tree4c2c0fc08229544880a43ff490f323759ec11465
parent8d24d68068f88e144bc70207f2c3e3ec3aa58e39
[project @ 2001-02-28 17:17:55 by simonpj]
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).
ghc/compiler/typecheck/TcSimplify.lhs