-
Simon Peyton Jones authored
------------ Rule phasing ------------ This commit adds a little more control to when rules are enabled. {-# RULES "foo" [2] forall ... "baz" [~2] forall ... #-} Rule "foo" is active in phase 2 and later. The new thing is that the "~2" means that Rule "baz" is active in phase 3 and earlier. (Remember tha phases decrease towards zero.) All the machinery was there to implement this, it just needed the syntax. Why do this? Peter Gammie (at UNSW) found that rules weren't firing because of bindings of the form M.f = f f = .... where the rules where on the M.f binding. It turned out that an old hack (which have for some time elicited the harmless "shortMeOut" debug warnings) prevented this trivial construction from being correctly simplified. The hack in turn derived from a trick in the way the foldr/build rule was implemented....and that hack is no longer necessary now we can switch rules *off* as well as *on*. There are consequential changes in the Prelude foldr/build RULE stuff. It's a clean-up.... Instead of strange definitions like map = mapList which we had before, we have an ordinary recursive defn of map, together with rules to convert first to foldr/build form, and then (if nothing happens) back again. There's a fairly long comment about the general plan of attack in PrelBase, near the defn of map.
f2054812