Hi! Ghc seems to have some problems in inferring the most general types of RULES pragmas. The bug was not present in 5.02.1 but shows up in a cvs version checked out yesterday.
Here's the problem: Consider the following example from the user's guide: {-# RULES "map/map" forall f g xs. map f (map g xs) = map (f.g) xs #-} When I compile with -ddump-rules I get the following rule: "map/map" __forall {@ b @ b @ a f :: (b -> b) g :: (a -> b) xs :: [a]} GHC.Base.map @ b @ b f (GHC.Base.map @ a @ b g xs) = GHC.Base.map @ a @ b (GHC.Base.. @ b @ b @ a f g) xs ; (And it also turns out this rule is listed among the imported rules, not the local ones, which is a bit confusing.) The rule says that f must have type b -> b for some b. This is clearly Bad as the matching algorithm also matches types and the rule will not be fired in all the cases it should. When I add a type signature for f then g get type b -> b. In order to get the desired behaviour I have to add type signatures to both f and g. I hope this is easy to fix. Cheers, /Josef PS. Would it be possible to add a -fwarn-pragma which warns when a pragma is ignored? It is quite frustrating when some rules are silently ignored and you keep wonder why the rules don't fire. I guess I've learnt to use -ddump-rule the hard way... _______________________________________________ Glasgow-haskell-bugs mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs