diff options
| author | Joachim Breitner <mail@joachim-breitner.de> | 2014-10-28 15:28:59 +0100 |
|---|---|---|
| committer | Joachim Breitner <mail@joachim-breitner.de> | 2014-10-28 15:30:35 +0100 |
| commit | 98ed815f658bdf9cc0299a4818244c3a56c20487 (patch) | |
| tree | 82ead2e292758b7736aa5f99e430428e373bb3cf | |
| parent | 3d6422b20db918d1911dd52470a2dad04fd5e1bc (diff) | |
| download | haskell-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.lhs | 3 |
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) |
