on master help sign in
Future-proof against potential Prelude.foldl' - part 2
commitfe3fd67b0188daabb8e18a52798c435517c2aa4f authorBodigrim <andrew.lelechenko@gmail.com> dateTue 6 Jun 2023, 22:40 (3 years ago) parentf2d9ba8
6 files changed+15−14
benchmark/Streamly/Benchmark/Data/Stream/Common.hs+1−1 benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs+4−4 src/Streamly/Internal/Data/Stream/IsStream/Eliminate.hs+3−3 src/Streamly/Internal/Data/Stream/IsStream/Top.hs+1−1 src/Streamly/Internal/Data/Stream/IsStream/Type.hs+2−1 src/Streamly/Prelude.hs+4−4
benchmark/Streamly/Benchmark/Data/Stream/Common.hs+1−1
@@ -103,7 +103,7 @@ import qualified Streamly.Internal.Data.Stream.StreamD as StreamK
103103#endif
104104
105105import Gauge
106−import Prelude hiding (mapM, replicate)
106+import Prelude hiding (Foldable(..), mapM, replicate)
107107
108108#ifdef USE_STREAMK
109109toStream :: Applicative m => StreamK m a -> Stream m a
benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs+4−4
@@ -26,7 +26,7 @@ import Control.Monad (when)
2626import Data.Maybe (isJust)
2727import System.Random (randomRIO)
2828import Prelude hiding
29− ( tail, mapM_, foldl, last, map, mapM, concatMap, zipWith, init, iterate
29+ ( Foldable(..), tail, mapM_, last, map, mapM, concatMap, zipWith, init, iterate
3030 , repeat, replicate
3131 )
3232
@@ -167,15 +167,15 @@ fromFoldable streamLen n = S.fromFoldable [n..n+streamLen]
167167{-# INLINE fromFoldableM #-}
168168fromFoldableM :: Monad m => Int -> Int -> Stream m Int
169169fromFoldableM streamLen n =
170− Prelude.foldr S.consM S.nil (Prelude.fmap return [n..n+streamLen])
170+ List.foldr S.consM S.nil (Prelude.fmap return [n..n+streamLen])
171171
172172{-# INLINABLE concatMapFoldableWith #-}
173−concatMapFoldableWith :: Foldable f
173+concatMapFoldableWith :: P.Foldable f
174174 => (Stream m b -> Stream m b -> Stream m b)
175175 -> (a -> Stream m b)
176176 -> f a
177177 -> Stream m b
178−concatMapFoldableWith f g = Prelude.foldr (f . g) S.nil
178+concatMapFoldableWith f g = P.foldr (f . g) S.nil
179179
180180{-# INLINE concatMapFoldableSerial #-}
181181concatMapFoldableSerial :: Int -> Int -> Stream m Int
src/Streamly/Internal/Data/Stream/IsStream/Eliminate.hs+3−3
@@ -182,9 +182,9 @@ import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
182182import qualified System.IO as IO
183183
184184import Prelude hiding
185− ( drop, take, takeWhile, foldr , foldl, mapM_, sequence, all, any, sum
186− , product, elem, notElem, maximum, minimum, head, last, tail, length
187− , null , reverse, init, and, or, lookup, foldr1, (!!) , splitAt, break
185+ ( Foldable(..), drop, take, takeWhile, mapM_, sequence, all, any
186+ , notElem, head, last, tail
187+ , reverse, init, and, or, lookup, (!!), splitAt, break
188188 , mconcat)
189189
190190-- $setup
src/Streamly/Internal/Data/Stream/IsStream/Top.hs+1−1
@@ -85,7 +85,7 @@ import qualified Streamly.Internal.Data.Stream.IsStream.Transform as Stream
8585import qualified Streamly.Internal.Data.Stream.IsStream.Type as IsStream
8686import qualified Streamly.Internal.Data.Stream.StreamD as StreamD
8787
88−import Prelude hiding (filter, zipWith, concatMap, concat)
88+import Prelude hiding (Foldable(..), filter, zipWith, concatMap, concat)
8989
9090-- $setup
9191-- >>> :m
src/Streamly/Internal/Data/Stream/IsStream/Type.hs+2−1
@@ -133,7 +133,8 @@ import qualified Streamly.Internal.Data.Stream.Serial as Stream
133133import qualified Streamly.Internal.Data.Stream.Zip as Zip
134134import qualified Streamly.Internal.Data.Stream.ZipAsync as ZipAsync
135135
136−import Prelude hiding (foldr, repeat)
136+import Prelude hiding (Foldable(..), repeat)
137+import Data.Foldable (Foldable)
137138
138139#include "inline.hs"
139140
src/Streamly/Prelude.hs+4−4
@@ -943,10 +943,10 @@ where
943943
944944import Streamly.Internal.Control.Concurrent (MonadAsync)
945945import Prelude
946− hiding (filter, drop, dropWhile, take, takeWhile, zipWith, foldr,
947− foldl, map, mapM, mapM_, sequence, all, any, sum, product, elem,
948− notElem, maximum, minimum, head, last, tail, length, null,
949− reverse, iterate, init, and, or, lookup, foldr1, (!!),
946+ hiding (Foldable(..), filter, drop, dropWhile, take, takeWhile, zipWith,
947+ map, mapM, mapM_, sequence, all, any,
948+ notElem, head, last, tail,
949+ reverse, iterate, init, and, or, lookup, (!!),
950950 scanl, scanl1, repeat, replicate, concatMap, span)
951951
952952import Streamly.Internal.Data.Stream.IsStream