diff options
author | Ben Gamari <ben@smart-cactus.org> | 2019-07-15 21:02:48 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-08-07 10:19:21 -0400 |
commit | 83ca42de519cdfa28b38164e90d726034dba768e (patch) | |
tree | 4f0d9e7c97ae10241c94385a75dafbeac153d3d5 | |
parent | f1d0e49f8a9a9175c83442430fac76ae225e52ae (diff) | |
download | haskell-83ca42de519cdfa28b38164e90d726034dba768e.tar.gz |
Revert "Make scanr a good producer and consumer"
This reverts commit 4e1dfc3767167dddd0e151a2df8305b12aa0f49c.
Due to #16943.
-rw-r--r-- | libraries/base/GHC/List.hs | 18 | ||||
-rw-r--r-- | libraries/base/changelog.md | 2 |
2 files changed, 2 insertions, 18 deletions
diff --git a/libraries/base/GHC/List.hs b/libraries/base/GHC/List.hs index 0ed8cafbd6..1846121bda 100644 --- a/libraries/base/GHC/List.hs +++ b/libraries/base/GHC/List.hs @@ -385,29 +385,11 @@ foldr1 f = go -- Note that -- -- > head (scanr f z xs) == foldr f z xs. -{-# NOINLINE [1] scanr #-} scanr :: (a -> b -> b) -> b -> [a] -> [b] scanr _ q0 [] = [q0] scanr f q0 (x:xs) = f x q : qs where qs@(q:_) = scanr f q0 xs -{-# INLINE [0] strictUncurryScanr #-} -strictUncurryScanr :: (a -> b -> c) -> (a, b) -> c -strictUncurryScanr f pair = case pair of - (x, y) -> f x y - -{-# INLINE [0] scanrFB #-} -- See Note [Inline FB functions] -scanrFB :: (a -> b -> b) -> (b -> c -> c) -> a -> (b, c) -> (b, c) -scanrFB f c = \x (r, est) -> (f x r, r `c` est) - -{-# RULES -"scanr" [~1] forall f q0 ls . scanr f q0 ls = - build (\c n -> strictUncurryScanr c (foldr (scanrFB f c) (q0,n) ls)) -"scanrList" [1] forall f q0 ls . - strictUncurryScanr (:) (foldr (scanrFB f (:)) (q0,[]) ls) = - scanr f q0 ls - #-} - -- | \(\mathcal{O}(n)\). 'scanr1' is a variant of 'scanr' that has no starting -- value argument. scanr1 :: (a -> a -> a) -> [a] -> [a] diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md index d5694e7a39..7399f371d1 100644 --- a/libraries/base/changelog.md +++ b/libraries/base/changelog.md @@ -57,6 +57,8 @@ `Word`, and `WordN` now throw an overflow exception for negative shift values (instead of being undefined behaviour). + * `scanr` no longer participates in list fusion (due #16943) + ## 4.12.0.0 *21 September 2018* * Bundled with GHC 8.6.1 |