diff options
author | David Feuer <David.Feuer@gmail.com> | 2014-10-01 15:57:27 +0200 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2014-10-01 15:57:27 +0200 |
commit | 1bc83b8a3d5ac01357d42b14d513312e98e2bb29 (patch) | |
tree | 2aa8d2b04461ff3d376f552542ad4862a53818a7 | |
parent | 6680f4fdebf23c1d8e443f2c658e3bc3ab43f295 (diff) | |
download | haskell-wip/validate-T9536.tar.gz |
Fusion rule for "foldr k z (x:build g)"wip/validate-T9536
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.
-rw-r--r-- | libraries/base/GHC/Base.lhs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libraries/base/GHC/Base.lhs b/libraries/base/GHC/Base.lhs index 8b51c07645..f9d01b5269 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)) |