diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2021-10-27 17:18:51 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-29 05:02:25 -0400 |
commit | 7170052651ff02bfcf1e9611f0813dd20a7c8558 (patch) | |
tree | 19f4b1baa46eb0158f0e929117f86182ec07638d /libraries/base/GHC/Real.hs | |
parent | 522eab3f056905db47110c73dac1833f4a2880f2 (diff) | |
download | haskell-7170052651ff02bfcf1e9611f0813dd20a7c8558.tar.gz |
Add more INLINABLE and INLINE pragmas to `Enum Int*` instances
Otherwise the instances aren't good list producers.
See Note [Stable Unfolding for list producers].
Diffstat (limited to 'libraries/base/GHC/Real.hs')
-rw-r--r-- | libraries/base/GHC/Real.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libraries/base/GHC/Real.hs b/libraries/base/GHC/Real.hs index e71a91007e..a4d97b0497 100644 --- a/libraries/base/GHC/Real.hs +++ b/libraries/base/GHC/Real.hs @@ -813,9 +813,13 @@ lcm x y = abs ((x `quot` (gcd x y)) * y) "gcd/Word->Word->Word" gcd = gcdWord #-} +-- See Note [Stable Unfolding for list producers] in GHC.Enum +{-# INLINABLE integralEnumFrom #-} integralEnumFrom :: (Integral a, Bounded a) => a -> [a] integralEnumFrom n = map fromInteger [toInteger n .. toInteger (maxBound `asTypeOf` n)] +-- See Note [Stable Unfolding for list producers] in GHC.Enum +{-# INLINABLE integralEnumFromThen #-} integralEnumFromThen :: (Integral a, Bounded a) => a -> a -> [a] integralEnumFromThen n1 n2 | i_n2 >= i_n1 = map fromInteger [i_n1, i_n2 .. toInteger (maxBound `asTypeOf` n1)] @@ -824,9 +828,13 @@ integralEnumFromThen n1 n2 i_n1 = toInteger n1 i_n2 = toInteger n2 +-- See Note [Stable Unfolding for list producers] in GHC.Enum +{-# INLINABLE integralEnumFromTo #-} integralEnumFromTo :: Integral a => a -> a -> [a] integralEnumFromTo n m = map fromInteger [toInteger n .. toInteger m] +-- See Note [Stable Unfolding for list producers] in GHC.Enum +{-# INLINABLE integralEnumFromThenTo #-} integralEnumFromThenTo :: Integral a => a -> a -> a -> [a] integralEnumFromThenTo n1 n2 m = map fromInteger [toInteger n1, toInteger n2 .. toInteger m] |