Commit dc671a1c authored by Joachim Breitner's avatar Joachim Breitner

SPECIALIZE strictMinimum for Int and Integer

This fixes a regression reported in #10788, where due to less inlining
compared to earlier versions, we’d get worse code. With the SPECIALIZE,
we get the good code, and moreover, the good code is in List.hs and
_not_ inlined to the use site, so smaller code size and less compilation
time.
parent 1abbacd6
......@@ -415,6 +415,8 @@ maximum xs = foldl1 max xs
strictMaximum :: (Ord a) => [a] -> a
strictMaximum [] = errorEmptyList "maximum"
strictMaximum xs = foldl1' max xs
{-# SPECIALIZE strictMaximum :: [Int] -> Int #-}
{-# SPECIALIZE strictMaximum :: [Integer] -> Integer #-}
-- | 'minimum' returns the minimum value from a list,
-- which must be non-empty, finite, and of an ordered type.
......@@ -433,6 +435,8 @@ minimum xs = foldl1 min xs
strictMinimum :: (Ord a) => [a] -> a
strictMinimum [] = errorEmptyList "minimum"
strictMinimum xs = foldl1' min xs
{-# SPECIALIZE strictMinimum :: [Int] -> Int #-}
{-# SPECIALIZE strictMinimum :: [Integer] -> Integer #-}
-- | 'iterate' @f x@ returns an infinite list of repeated applications
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment