diff options
author | Hécate <hecate+gitlab@glitchbra.in> | 2020-12-23 14:56:42 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-01-02 07:35:54 -0500 |
commit | bc383cb060adc97cb38e41acfb42d63a449f4b64 (patch) | |
tree | 9e0292f58e3847a63c0e017db95deb65d64ec52e | |
parent | d9788fd27da499bd8ca8c38980728088b961a5bc (diff) | |
download | haskell-bc383cb060adc97cb38e41acfb42d63a449f4b64.tar.gz |
Upstream the strictness optimisation for GHC.List.{sum,product}
-rw-r--r-- | libraries/base/GHC/List.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 732ba13848..4146b68319 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -340,7 +340,7 @@ foldl1' _ [] = errorEmptyList "foldl1'" -- * Hangs forever * sum :: (Num a) => [a] -> a {-# INLINE sum #-} -sum = foldl (+) 0 +sum = foldl' (+) 0 -- | The 'product' function computes the product of a finite list of numbers. -- @@ -356,7 +356,7 @@ sum = foldl (+) 0 -- * Hangs forever * product :: (Num a) => [a] -> a {-# INLINE product #-} -product = foldl (*) 1 +product = foldl' (*) 1 -- | \(\mathcal{O}(n)\). 'scanl' is similar to 'foldl', but returns a list of -- successive reduced values from the left: |