[commit: ghc] wip/validate-T9536: Fusion rule for "foldr k z (x:build g)" (1bc83b8)
git at git.haskell.org
git at git.haskell.org
Wed Oct 1 13:58:35 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/validate-T9536
Link : http://ghc.haskell.org/trac/ghc/changeset/1bc83b8a3d5ac01357d42b14d513312e98e2bb29/ghc
>---------------------------------------------------------------
commit 1bc83b8a3d5ac01357d42b14d513312e98e2bb29
Author: David Feuer <David.Feuer at gmail.com>
Date: Wed Oct 1 15:57:27 2014 +0200
Fusion rule for "foldr k z (x:build g)"
There seem to be various issues with general fold/cons and even
cons/build rules, but it seems pretty clear to me that the simple
fold/cons/build rule is a good idea. It doesn't do much for nofib
allocation, but it seems to improve some other analyses and speed
several benchmarks up. Implements #9536.
>---------------------------------------------------------------
1bc83b8a3d5ac01357d42b14d513312e98e2bb29
libraries/base/GHC/Base.lhs | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libraries/base/GHC/Base.lhs b/libraries/base/GHC/Base.lhs
index 8b51c07..f9d01b5 100644
--- a/libraries/base/GHC/Base.lhs
+++ b/libraries/base/GHC/Base.lhs
@@ -788,6 +788,9 @@ augment g xs = g (:) xs
"foldr/single" forall k z x. foldr k z [x] = k x z
"foldr/nil" forall k z. foldr k z [] = z
+"foldr/cons/build" forall k z x (g::forall b. (a->b->b) -> b -> b) .
+ foldr k z (x:build g) = k x (g k z)
+
"augment/build" forall (g::forall b. (a->b->b) -> b -> b)
(h::forall b. (a->b->b) -> b -> b) .
augment g (build h) = build (\c n -> g c (h c n))
More information about the ghc-commits
mailing list