Skip to content

Commit fe3fd67

Browse files
Bodigrimharendra-kumar
authored andcommitted
Future-proof against potential Prelude.foldl' - part 2
1 parent f2d9ba8 commit fe3fd67

File tree

6 files changed

+15
-14
lines changed

6 files changed

+15
-14
lines changed

benchmark/Streamly/Benchmark/Data/Stream/Common.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ import qualified Streamly.Internal.Data.Stream.StreamD as StreamK
103103
#endif
104104

105105
import Gauge
106-
import Prelude hiding (mapM, replicate)
106+
import Prelude hiding (Foldable(..), mapM, replicate)
107107

108108
#ifdef USE_STREAMK
109109
toStream :: Applicative m => StreamK m a -> Stream m a

benchmark/Streamly/Benchmark/Data/Stream/StreamK.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import Control.Monad (when)
2626
import Data.Maybe (isJust)
2727
import System.Random (randomRIO)
2828
import 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 #-}
168168
fromFoldableM :: Monad m => Int -> Int -> Stream m Int
169169
fromFoldableM 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 #-}
181181
concatMapFoldableSerial :: Int -> Int -> Stream m Int

src/Streamly/Internal/Data/Stream/IsStream/Eliminate.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ import qualified Streamly.Internal.Data.Stream.StreamK.Type as K
182182
import qualified System.IO as IO
183183

184184
import 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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ import qualified Streamly.Internal.Data.Stream.IsStream.Transform as Stream
8585
import qualified Streamly.Internal.Data.Stream.IsStream.Type as IsStream
8686
import 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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ import qualified Streamly.Internal.Data.Stream.Serial as Stream
133133
import qualified Streamly.Internal.Data.Stream.Zip as Zip
134134
import 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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -943,10 +943,10 @@ where
943943

944944
import Streamly.Internal.Control.Concurrent (MonadAsync)
945945
import 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

952952
import Streamly.Internal.Data.Stream.IsStream

0 commit comments

Comments
 (0)