summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2015-09-28 13:48:40 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2015-09-28 13:48:40 +0200
commit78053f449d47a90c977ec3a893524f2cdb5d33f9 (patch)
treedde0cd0463e93eb49a52e911ec19a60f922d80bc
parentb4d43b4e9f4f4fba068ab1e132113c4cd305dfe3 (diff)
downloadhaskell-78053f449d47a90c977ec3a893524f2cdb5d33f9.tar.gz
Allow enumDeltaIntegerFB to be inlined
The function is very small and the compiler should be at liberty to inline it. But it is recursive, so it did not do it before. By applying the usual transformation with a local recursive function, GHC can now inline it, producing the loop that one would expect.
-rw-r--r--libraries/base/GHC/Enum.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/libraries/base/GHC/Enum.hs b/libraries/base/GHC/Enum.hs
index a11d4f8ccf..0d91cc7cbc 100644
--- a/libraries/base/GHC/Enum.hs
+++ b/libraries/base/GHC/Enum.hs
@@ -704,7 +704,8 @@ the special case varies more from the general case, due to the issue of overflow
{-# NOINLINE [0] enumDeltaIntegerFB #-}
enumDeltaIntegerFB :: (Integer -> b -> b) -> Integer -> Integer -> b
-enumDeltaIntegerFB c x d = x `seq` (x `c` enumDeltaIntegerFB c (x+d) d)
+enumDeltaIntegerFB c x d = go x
+ where go x = x `seq` (x `c` go (x+d))
{-# NOINLINE [1] enumDeltaInteger #-}
enumDeltaInteger :: Integer -> Integer -> [Integer]