diff options
-rw-r--r-- | libraries/base/Data/OldList.hs | 6 | ||||
-rw-r--r-- | libraries/base/changelog.md | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/libraries/base/Data/OldList.hs b/libraries/base/Data/OldList.hs index 211978dadd..ef5960542d 100644 --- a/libraries/base/Data/OldList.hs +++ b/libraries/base/Data/OldList.hs @@ -842,6 +842,7 @@ strictGenericLength l = gl l 0 where gl [] a = a gl (_:xs) a = let a' = a + 1 in a' `seq` gl xs a' +{-# INLINABLE strictGenericLength #-} -- | The 'genericTake' function is an overloaded version of 'take', which -- accepts any 'Integral' value as the number of elements to take. @@ -849,6 +850,7 @@ genericTake :: (Integral i) => i -> [a] -> [a] genericTake n _ | n <= 0 = [] genericTake _ [] = [] genericTake n (x:xs) = x : genericTake (n-1) xs +{-# INLINABLE genericTake #-} -- | The 'genericDrop' function is an overloaded version of 'drop', which -- accepts any 'Integral' value as the number of elements to drop. @@ -856,6 +858,7 @@ genericDrop :: (Integral i) => i -> [a] -> [a] genericDrop n xs | n <= 0 = xs genericDrop _ [] = [] genericDrop n (_:xs) = genericDrop (n-1) xs +{-# INLINABLE genericDrop #-} -- | The 'genericSplitAt' function is an overloaded version of 'splitAt', which @@ -865,6 +868,7 @@ genericSplitAt n xs | n <= 0 = ([],xs) genericSplitAt _ [] = ([],[]) genericSplitAt n (x:xs) = (x:xs',xs'') where (xs',xs'') = genericSplitAt (n-1) xs +{-# INLINABLE genericSplitAt #-} -- | The 'genericIndex' function is an overloaded version of '!!', which -- accepts any 'Integral' value as the index. @@ -874,11 +878,13 @@ genericIndex (_:xs) n | n > 0 = genericIndex xs (n-1) | otherwise = errorWithoutStackTrace "List.genericIndex: negative argument." genericIndex _ _ = errorWithoutStackTrace "List.genericIndex: index too large." +{-# INLINABLE genericIndex #-} -- | The 'genericReplicate' function is an overloaded version of 'replicate', -- which accepts any 'Integral' value as the number of repetitions to make. genericReplicate :: (Integral i) => i -> a -> [a] genericReplicate n x = genericTake n (repeat x) +{-# INLINABLE genericReplicate #-} -- | The 'zip4' function takes four lists and returns a list of -- quadruples, analogous to 'zip'. diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index b102de449c..bef533f263 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -6,6 +6,7 @@ types significantly. * Refactor `generalCategory` to stop very large literal string being inlined to call-sites. ([CLC proposal #130](https://github.com/haskell/core-libraries-committee/issues/130)) + * Add INLINABLE pragmas to `generic*` functions in Data.OldList ([CLC proposal #129](https://github.com/haskell/core-libraries-committee/issues/130)) ## 4.18.0.0 *TBA* |