summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHécate <hecate+gitlab@glitchbra.in>2020-12-23 17:11:52 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-02 07:35:54 -0500
commit4c178374983dddb75341352aef1d15658a82463b (patch)
tree8a11dea15bbd94336536c8f4d7a933796856e8d4
parentbc383cb060adc97cb38e41acfb42d63a449f4b64 (diff)
downloadhaskell-4c178374983dddb75341352aef1d15658a82463b.tar.gz
Upstream the strictness optimisation for GHC.List.{maximum,minimum}
-rw-r--r--libraries/base/GHC/List.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs
index 4146b68319..cd7ffc6637 100644
--- a/libraries/base/GHC/List.hs
+++ b/libraries/base/GHC/List.hs
@@ -614,7 +614,7 @@ scanr1 f (x:xs) = f x q : qs
maximum :: (Ord a) => [a] -> a
{-# INLINABLE maximum #-}
maximum [] = errorEmptyList "maximum"
-maximum xs = foldl1 max xs
+maximum xs = foldl1' max xs
-- We want this to be specialized so that with a strict max function, GHC
-- produces good code. Note that to see if this is happending, one has to
@@ -638,7 +638,7 @@ maximum xs = foldl1 max xs
minimum :: (Ord a) => [a] -> a
{-# INLINABLE minimum #-}
minimum [] = errorEmptyList "minimum"
-minimum xs = foldl1 min xs
+minimum xs = foldl1' min xs
{-# SPECIALIZE minimum :: [Int] -> Int #-}
{-# SPECIALIZE minimum :: [Integer] -> Integer #-}