[project @ 2001-03-01 15:06:52 by simonpj]
authorsimonpj <unknown>
Thu, 1 Mar 2001 15:06:52 +0000 (15:06 +0000)
committersimonpj <unknown>
Thu, 1 Mar 2001 15:06:52 +0000 (15:06 +0000)
commitf4ed011ba22d844c62edabfa27f2c8bc6ed4d349
tree84a5ee2e53d1e973b7e69c98848e1531bef525f8
parent6934a650f1d58e5621699991f2cbea44e2f2e6e7
[project @ 2001-03-01 15:06:52 by simonpj]
Improve rule matching even more

Manuel discovered that given

  {-# RULES "fst over sndSnd" forall v. fst (sndSnd v) = fst v #-}

  sndSnd :: (a, (b, c)) -> (a, c)
  sndSnd (x, (y, z)) = (x, z)

the rule gets a type, which is too specialised, namely

  {-## __R "fst over sndSnd" __forall {@ a1 v :: (a1, ((), ()))}
   fst @ a1 @ () (sndSnd @ a1 @ () @ () v) = fst @ a1 @ ((), ()) v ;

This was because TcRules wasn't quantifying over enough type variables.

This commit fixes the problem.
The test is in tests/simplCore/should_run/simplrun002
ghc/compiler/typecheck/TcRules.lhs
ghc/tests/simplCore/should_run/Makefile
ghc/tests/simplCore/should_run/simplrun001.hs
ghc/tests/simplCore/should_run/simplrun001.stderr
ghc/tests/simplCore/should_run/simplrun002.hs [new file with mode: 0644]
ghc/tests/simplCore/should_run/simplrun002.stderr [new file with mode: 0644]
ghc/tests/simplCore/should_run/simplrun002.stdout [new file with mode: 0644]