summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2014-10-28 15:28:59 +0100
committerJoachim Breitner <mail@joachim-breitner.de>2014-10-28 15:30:35 +0100
commit98ed815f658bdf9cc0299a4818244c3a56c20487 (patch)
tree82ead2e292758b7736aa5f99e430428e373bb3cf
parent3d6422b20db918d1911dd52470a2dad04fd5e1bc (diff)
downloadhaskell-98ed815f658bdf9cc0299a4818244c3a56c20487.tar.gz
Make iterateFB inlineable
When investigating a case of unexpected Call Arity failure I noticed that iterateFB would not inline as far as desired, as it is recursive. This patch makes it non-recursive (with a local go), which seem so do great good.
-rw-r--r--libraries/base/GHC/List.lhs3
1 files changed, 2 insertions, 1 deletions
diff --git a/libraries/base/GHC/List.lhs b/libraries/base/GHC/List.lhs
index 2d01678691..f993ee78d1 100644
--- a/libraries/base/GHC/List.lhs
+++ b/libraries/base/GHC/List.lhs
@@ -352,7 +352,8 @@ iterate f x = x : iterate f (f x)
{-# NOINLINE [0] iterateFB #-}
iterateFB :: (a -> b -> b) -> (a -> a) -> a -> b
-iterateFB c f x = x `c` iterateFB c f (f x)
+iterateFB c f x0 = go x0
+ where go x = x `c` go (f x)
{-# RULES
"iterate" [~1] forall f x. iterate f x = build (\c _n -> iterateFB c f x)