@@ -23,15 +23,14 @@ import Data.IntMap.Strict (IntMap)
2323import Data.Monoid (Last(..), Sum(..))
2424import System.Random (randomRIO)
2525
26−import Streamly.Prelude (SerialT)
26+import Streamly.Internal.Data.Stream (Stream)
2727import Streamly.Internal.Data.Fold (Fold(..))
2828import Streamly.Internal.Data.IsMap.HashMap ()
2929
3030import qualified Streamly.Internal.Data.Fold as FL
3131import qualified Streamly.Internal.Data.Unfold as Unfold
3232import qualified Streamly.Internal.Data.Pipe as Pipe
33−import qualified Streamly.Internal.Data.Stream.IsStream as IP
34−import qualified Streamly.Prelude as S
33+import qualified Streamly.Internal.Data.Stream as Stream
3534
3635import Gauge
3736import Streamly.Benchmark.Common
@@ -41,8 +40,8 @@ import Prelude hiding (all, any, take, unzip, sequence_, filter)
4140-- completely optimized out by the compiler in some cases.
4241
4342{-# INLINE sourceUnfoldrM #-}
44−sourceUnfoldrM :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m Int
45−sourceUnfoldrM value n = S.unfoldrM step n
43+sourceUnfoldrM :: Monad m => Int -> Int -> Stream m Int
44+sourceUnfoldrM value n = Stream.unfoldrM step n
4645 where
4746 step cnt =
4847 if cnt > n + value
@@ -50,14 +49,14 @@ sourceUnfoldrM value n = S.unfoldrM step n
5049 else return (Just (cnt, cnt + 1))
5150
5251{-# INLINE source #-}
53−source :: (S.MonadAsync m, S.IsStream t) => Int -> Int -> t m Int
52+source :: Monad m => Int -> Int -> Stream m Int
5453source = sourceUnfoldrM
5554
5655-- | Takes a fold method, and uses it with a default source.
5756{-# INLINE benchIOSink #-}
5857benchIOSink
59− :: (S.IsStream t, NFData b)
60− => Int -> String -> (t IO Int -> IO b) -> Benchmark
58+ :: NFData b
59+ => Int -> String -> (Stream IO Int -> IO b) -> Benchmark
6160benchIOSink value name f = bench name $ nfIO $ randomRIO (1,1) >>= f . source value
6261
6362-------------------------------------------------------------------------------
@@ -65,16 +64,16 @@ benchIOSink value name f = bench name $ nfIO $ randomRIO (1,1) >>= f . source va
6564-------------------------------------------------------------------------------
6665
6766{-# INLINE any #-}
68−any :: (Monad m, Ord a) => a -> SerialT m a -> m Bool
69−any value = IP.fold (FL.any (> value))
67+any :: (Monad m, Ord a) => a -> Stream m a -> m Bool
68+any value = Stream.fold (FL.any (> value))
7069
7170{-# INLINE all #-}
72−all :: (Monad m, Ord a) => a -> SerialT m a -> m Bool
73−all value = IP.fold (FL.all (<= value))
71+all :: (Monad m, Ord a) => a -> Stream m a -> m Bool
72+all value = Stream.fold (FL.all (<= value))
7473
7574{-# INLINE take #-}
76−take :: Monad m => Int -> SerialT m a -> m ()
77−take value = IP.fold (FL.take value FL.drain)
75+take :: Monad m => Int -> Stream m a -> m ()
76+take value = Stream.fold (FL.take value FL.drain)
7877
7978{-# INLINE sequence_ #-}
8079sequence_ :: Monad m => Int -> Fold m a ()
@@ -91,17 +90,17 @@ sequence_ value =
9190-------------------------------------------------------------------------------
9291
9392{-# INLINE filter #-}
94−filter :: Monad m => Int -> SerialT m Int -> m ()
95−filter _ = IP.fold (FL.filter even FL.drain)
93+filter :: Monad m => Int -> Stream m Int -> m ()
94+filter _ = Stream.fold (FL.filter even FL.drain)
9695
9796{-# INLINE foldFilter #-}
98−foldFilter :: Monad m => Int -> SerialT m Int -> m ()
99−foldFilter _ = IP.fold (FL.foldFilter (FL.satisfy even) FL.drain)
97+foldFilter :: Monad m => Int -> Stream m Int -> m ()
98+foldFilter _ = Stream.fold (FL.foldFilter (FL.satisfy even) FL.drain)
10099
101100{-# INLINE foldFilter2 #-}
102−foldFilter2 :: Monad m => Int -> SerialT m Int -> m ()
101+foldFilter2 :: Monad m => Int -> Stream m Int -> m ()
103102foldFilter2 _ =
104− IP.fold
103+ Stream.fold
105104 $ FL.foldFilter (FL.satisfy even)
106105 $ FL.foldFilter (FL.satisfy odd) FL.drain
107106
@@ -110,43 +109,43 @@ foldFilter2 _ =
110109-------------------------------------------------------------------------------
111110
112111{-# INLINE takeEndBy_ #-}
113−takeEndBy_ :: Monad m => Int -> SerialT m Int -> m ()
114−takeEndBy_ value = IP.fold (FL.takeEndBy_ (>= value) FL.drain)
112+takeEndBy_ :: Monad m => Int -> Stream m Int -> m ()
113+takeEndBy_ value = Stream.fold (FL.takeEndBy_ (>= value) FL.drain)
115114
116115{-# INLINE many #-}
117−many :: Monad m => SerialT m Int -> m ()
118−many = IP.fold (FL.many (FL.take 1 FL.drain) FL.drain)
116+many :: Monad m => Stream m Int -> m ()
117+many = Stream.fold (FL.many (FL.take 1 FL.drain) FL.drain)
119118
120119{-# INLINE splitAllAny #-}
121−splitAllAny :: Monad m => Int -> SerialT m Int -> m (Bool, Bool)
120+splitAllAny :: Monad m => Int -> Stream m Int -> m (Bool, Bool)
122121splitAllAny value =
123− IP.fold
122+ Stream.fold
124123 (FL.serialWith (,)
125124 (FL.all (<= (value `div` 2)))
126125 (FL.any (> value))
127126 )
128127
129128{-# INLINE serial_ #-}
130−serial_ :: Monad m => Int -> SerialT m Int -> m Bool
129+serial_ :: Monad m => Int -> Stream m Int -> m Bool
131130serial_ value =
132− IP.fold
131+ Stream.fold
133132 (FL.serial_
134133 (FL.all (<= (value `div` 2)))
135134 (FL.any (> value))
136135 )
137136
138137{-# INLINE shortest #-}
139−shortest :: Monad m => SerialT m Int -> m (Either Int Int)
140−shortest = IP.fold (FL.shortest FL.sum FL.length)
138+shortest :: Monad m => Stream m Int -> m (Either Int Int)
139+shortest = Stream.fold (FL.shortest FL.sum FL.length)
141140
142141{-# INLINE longest #-}
143−longest :: Monad m => SerialT m Int -> m (Either Int Int)
144−longest = IP.fold (FL.longest FL.sum FL.length)
142+longest :: Monad m => Stream m Int -> m (Either Int Int)
143+longest = Stream.fold (FL.longest FL.sum FL.length)
145144
146145{-# INLINE foldBreak #-}
147−foldBreak :: Monad m => SerialT m Int -> m ()
146+foldBreak :: Monad m => Stream m Int -> m ()
148147foldBreak s = do
149− (r, s1) <- IP.foldBreak (FL.take 1 FL.length) s
148+ (r, s1) <- Stream.foldBreak (FL.take 1 FL.length) s
150149 when (r /= 0) $ foldBreak s1
151150
152151-------------------------------------------------------------------------------
@@ -154,12 +153,12 @@ foldBreak s = do
154153-------------------------------------------------------------------------------
155154
156155{-# INLINE teeSumLength #-}
157−teeSumLength :: Monad m => SerialT m Int -> m (Int, Int)
158−teeSumLength = IP.fold (FL.teeWith (,) FL.sum FL.length)
156+teeSumLength :: Monad m => Stream m Int -> m (Int, Int)
157+teeSumLength = Stream.fold (FL.teeWith (,) FL.sum FL.length)
159158
160159{-# INLINE teeAllAny #-}
161−teeAllAny :: (Monad m, Ord a) => a -> SerialT m a -> m (Bool, Bool)
162−teeAllAny value = IP.fold (FL.teeWith (,) all_ any_)
160+teeAllAny :: (Monad m, Ord a) => a -> Stream m a -> m (Bool, Bool)
161+teeAllAny value = Stream.fold (FL.teeWith (,) all_ any_)
163162
164163 where
165164
@@ -167,16 +166,16 @@ teeAllAny value = IP.fold (FL.teeWith (,) all_ any_)
167166 any_ = FL.any (> value)
168167
169168{-# INLINE teeWithFst #-}
170−teeWithFst :: Monad m => SerialT m Int -> m (Int, Int)
171−teeWithFst = IP.fold (FL.teeWithFst (,) FL.sum FL.length)
169+teeWithFst :: Monad m => Stream m Int -> m (Int, Int)
170+teeWithFst = Stream.fold (FL.teeWithFst (,) FL.sum FL.length)
172171
173172{-# INLINE teeWithMin #-}
174−teeWithMin :: Monad m => SerialT m Int -> m (Int, Int)
175−teeWithMin = IP.fold (FL.teeWithMin (,) FL.sum FL.length)
173+teeWithMin :: Monad m => Stream m Int -> m (Int, Int)
174+teeWithMin = Stream.fold (FL.teeWithMin (,) FL.sum FL.length)
176175
177176{-# INLINE distribute #-}
178−distribute :: Monad m => SerialT m Int -> m [Int]
179−distribute = IP.fold (FL.distribute [FL.sum, FL.length])
177+distribute :: Monad m => Stream m Int -> m [Int]
178+distribute = Stream.fold (FL.distribute [FL.sum, FL.length])
180179
181180-------------------------------------------------------------------------------
182181-- Partitioning
@@ -187,88 +186,88 @@ oddEven :: Int -> Either Int Int
187186oddEven x = if odd x then Left x else Right x
188187
189188{-# INLINE partition #-}
190−partition :: Monad m => SerialT m Int -> m (Int, Int)
191−partition = IP.fold $ FL.lmap oddEven (FL.partition FL.sum FL.length)
189+partition :: Monad m => Stream m Int -> m (Int, Int)
190+partition = Stream.fold $ FL.lmap oddEven (FL.partition FL.sum FL.length)
192191
193192{-# INLINE partitionByFstM #-}
194−partitionByFstM :: Monad m => SerialT m Int -> m (Int, Int)
193+partitionByFstM :: Monad m => Stream m Int -> m (Int, Int)
195194partitionByFstM =
196− IP.fold (FL.partitionByFstM (return . oddEven) FL.sum FL.length)
195+ Stream.fold (FL.partitionByFstM (return . oddEven) FL.sum FL.length)
197196
198197{-# INLINE partitionByMinM #-}
199−partitionByMinM :: Monad m => SerialT m Int -> m (Int, Int)
198+partitionByMinM :: Monad m => Stream m Int -> m (Int, Int)
200199partitionByMinM =
201− IP.fold (FL.partitionByMinM (return . oddEven) FL.sum FL.length)
200+ Stream.fold (FL.partitionByMinM (return . oddEven) FL.sum FL.length)
202201
203202{-# INLINE demuxWith #-}
204203demuxWith :: (Monad m, Ord k) =>
205− (a -> k) -> (a -> m (Fold m a b)) -> SerialT m a -> m (Map k b)
206−demuxWith f g = S.fold (FL.demuxWith f g)
204+ (a -> k) -> (a -> m (Fold m a b)) -> Stream m a -> m (Map k b)
205+demuxWith f g = Stream.fold (FL.demuxWith f g)
207206
208207{-# INLINE demuxWithInt #-}
209208demuxWithInt :: Monad m =>
210− (a -> Int) -> (a -> m (Fold m a b)) -> SerialT m a -> m (IntMap b)
211−demuxWithInt f g = S.fold (FL.demuxWith f g)
209+ (a -> Int) -> (a -> m (Fold m a b)) -> Stream m a -> m (IntMap b)
210+demuxWithInt f g = Stream.fold (FL.demuxWith f g)
212211
213212{-# INLINE demuxWithHash #-}
214213demuxWithHash :: (Monad m, Ord k, Hashable k) =>
215− (a -> k) -> (a -> m (Fold m a b)) -> SerialT m a -> m (HashMap k b)
216−demuxWithHash f g = S.fold (FL.demuxWith f g)
214+ (a -> k) -> (a -> m (Fold m a b)) -> Stream m a -> m (HashMap k b)
215+demuxWithHash f g = Stream.fold (FL.demuxWith f g)
217216
218217{-# INLINE demuxMutWith #-}
219218demuxMutWith :: (MonadIO m, Ord k) =>
220− (a -> k) -> (a -> m (Fold m a b)) -> SerialT m a -> m (Map k b)
221−demuxMutWith f g = S.fold (FL.demuxMutWith f g)
219+ (a -> k) -> (a -> m (Fold m a b)) -> Stream m a -> m (Map k b)
220+demuxMutWith f g = Stream.fold (FL.demuxMutWith f g)
222221
223222{-# INLINE demuxMutWithHash #-}
224223demuxMutWithHash :: (MonadIO m, Ord k, Hashable k) =>
225− (a -> k) -> (a -> m (Fold m a b)) -> SerialT m a -> m (HashMap k b)
226−demuxMutWithHash f g = S.fold (FL.demuxMutWith f g)
224+ (a -> k) -> (a -> m (Fold m a b)) -> Stream m a -> m (HashMap k b)
225+demuxMutWithHash f g = Stream.fold (FL.demuxMutWith f g)
227226
228227{-# INLINE classifyWith #-}
229228classifyWith ::
230− (Monad m, Ord k, Num a) => (a -> k) -> SerialT m a -> m (Map k a)
231−classifyWith f = S.fold (FL.classifyWith f FL.sum)
229+ (Monad m, Ord k, Num a) => (a -> k) -> Stream m a -> m (Map k a)
230+classifyWith f = Stream.fold (FL.classifyWith f FL.sum)
232231
233232{-# INLINE classifyWithInt #-}
234233classifyWithInt ::
235− (MonadIO m, Num a) => (a -> Int) -> SerialT m a -> m (IntMap a)
236−classifyWithInt f = S.fold (FL.classifyWith f FL.sum)
234+ (Monad m, Num a) => (a -> Int) -> Stream m a -> m (IntMap a)
235+classifyWithInt f = Stream.fold (FL.classifyWith f FL.sum)
237236
238237{-# INLINE classifyMutWith #-}
239238classifyMutWith ::
240− (MonadIO m, Ord k, Num a) => (a -> k) -> SerialT m a -> m (Map k a)
241−classifyMutWith f = S.fold (FL.classifyMutWith f FL.sum)
239+ (MonadIO m, Ord k, Num a) => (a -> k) -> Stream m a -> m (Map k a)
240+classifyMutWith f = Stream.fold (FL.classifyMutWith f FL.sum)
242241
243242{-# INLINE classifyMutWithInt #-}
244243classifyMutWithInt ::
245− (MonadIO m, Num a) => (a -> Int) -> SerialT m a -> m (IntMap a)
246−classifyMutWithInt f = S.fold (FL.classifyMutWith f FL.sum)
244+ (MonadIO m, Num a) => (a -> Int) -> Stream m a -> m (IntMap a)
245+classifyMutWithInt f = Stream.fold (FL.classifyMutWith f FL.sum)
247246
248247{-# INLINE classifyMutWithHash #-}
249248classifyMutWithHash :: (MonadIO m, Ord k, Num a, Hashable k) =>
250− (a -> k) -> SerialT m a -> m (HashMap k a)
251−classifyMutWithHash f = S.fold (FL.classifyMutWith f FL.sum)
249+ (a -> k) -> Stream m a -> m (HashMap k a)
250+classifyMutWithHash f = Stream.fold (FL.classifyMutWith f FL.sum)
252251
253252-------------------------------------------------------------------------------
254253-- unzip
255254-------------------------------------------------------------------------------
256255
257256{-# INLINE unzip #-}
258−unzip :: Monad m => SerialT m Int -> m (Int, Int)
259−unzip = IP.fold $ FL.lmap (\a -> (a, a)) (FL.unzip FL.sum FL.length)
257+unzip :: Monad m => Stream m Int -> m (Int, Int)
258+unzip = Stream.fold $ FL.lmap (\a -> (a, a)) (FL.unzip FL.sum FL.length)
260259
261260{-# INLINE unzipWithFstM #-}
262−unzipWithFstM :: Monad m => SerialT m Int -> m (Int, Int)
261+unzipWithFstM :: Monad m => Stream m Int -> m (Int, Int)
263262unzipWithFstM = do
264263 let f = \a -> return (a + 1, a)
265− IP.fold (FL.unzipWithFstM f FL.sum FL.length)
264+ Stream.fold (FL.unzipWithFstM f FL.sum FL.length)
266265
267266{-# INLINE unzipWithMinM #-}
268−unzipWithMinM :: Monad m => SerialT m Int -> m (Int, Int)
267+unzipWithMinM :: Monad m => Stream m Int -> m (Int, Int)
269268unzipWithMinM = do
270269 let f = \a -> return (a + 1, a)
271− IP.fold (FL.unzipWithMinM f FL.sum FL.length)
270+ Stream.fold (FL.unzipWithMinM f FL.sum FL.length)
272271
273272-------------------------------------------------------------------------------
274273-- Nested
@@ -278,8 +277,8 @@ unzipWithMinM = do
278277unfoldMany :: Int -> Benchmarkable
279278unfoldMany val =
280279 nfIO
281− $ IP.fold (FL.unfoldMany (Unfold.replicateM val) FL.drain)
282− $ IP.fromPure (randomRIO (1, 1 :: Int))
280+ $ Stream.fold (FL.unfoldMany (Unfold.replicateM val) FL.drain)
281+ $ Stream.fromPure (randomRIO (1, 1 :: Int))
283282
284283-------------------------------------------------------------------------------
285284-- Benchmarks
@@ -291,103 +290,103 @@ moduleName = "Data.Fold"
291290o_1_space_serial_elimination :: Int -> [Benchmark]
292291o_1_space_serial_elimination value =
293292 [ bgroup "elimination"
294− [ benchIOSink value "drain" (S.fold FL.drain)
295− , benchIOSink value "drainBy" (S.fold (FL.drainBy return))
296− , benchIOSink value "drainN" (S.fold (FL.drainN value))
297− , benchIOSink value "last" (S.fold FL.last)
298− , benchIOSink value "nub" (S.fold FL.nub)
299− , benchIOSink value "length" (S.fold FL.length)
300− , benchIOSink value "top" (S.fold $ FL.top 10)
301− , benchIOSink value "bottom" (S.fold $ FL.bottom 10)
302− , benchIOSink value "sum" (S.fold FL.sum)
303− , benchIOSink value "sum (foldMap)" (S.fold (FL.foldMap Sum))
304− , benchIOSink value "product" (S.fold FL.product)
305− , benchIOSink value "maximumBy" (S.fold (FL.maximumBy compare))
306− , benchIOSink value "maximum" (S.fold FL.maximum)
307− , benchIOSink value "minimumBy" (S.fold (FL.minimumBy compare))
308− , benchIOSink value "minimum" (S.fold FL.minimum)
293+ [ benchIOSink value "drain" (Stream.fold FL.drain)
294+ , benchIOSink value "drainBy" (Stream.fold (FL.drainBy return))
295+ , benchIOSink value "drainN" (Stream.fold (FL.drainN value))
296+ , benchIOSink value "last" (Stream.fold FL.last)
297+ , benchIOSink value "nub" (Stream.fold FL.nub)
298+ , benchIOSink value "length" (Stream.fold FL.length)
299+ , benchIOSink value "top" (Stream.fold $ FL.top 10)
300+ , benchIOSink value "bottom" (Stream.fold $ FL.bottom 10)
301+ , benchIOSink value "sum" (Stream.fold FL.sum)
302+ , benchIOSink value "sum (foldMap)" (Stream.fold (FL.foldMap Sum))
303+ , benchIOSink value "product" (Stream.fold FL.product)
304+ , benchIOSink value "maximumBy" (Stream.fold (FL.maximumBy compare))
305+ , benchIOSink value "maximum" (Stream.fold FL.maximum)
306+ , benchIOSink value "minimumBy" (Stream.fold (FL.minimumBy compare))
307+ , benchIOSink value "minimum" (Stream.fold FL.minimum)
309308 , benchIOSink
310309 value
311310 "mean"
312− (S.fold FL.mean . S.map (fromIntegral :: Int -> Double))
311+ (Stream.fold FL.mean . fmap (fromIntegral :: Int -> Double))
313312 , benchIOSink
314313 value
315314 "variance"
316− (S.fold FL.variance . S.map (fromIntegral :: Int -> Double))
315+ (Stream.fold FL.variance . fmap (fromIntegral :: Int -> Double))
317316 , benchIOSink
318317 value
319318 "stdDev"
320− (S.fold FL.stdDev . S.map (fromIntegral :: Int -> Double))
319+ (Stream.fold FL.stdDev . fmap (fromIntegral :: Int -> Double))
321320 , benchIOSink
322321 value
323322 "mconcat"
324− (S.fold FL.mconcat . S.map (Last . Just))
323+ (Stream.fold FL.mconcat . fmap (Last . Just))
325324 , benchIOSink
326325 value
327326 "foldMap"
328− (S.fold (FL.foldMap (Last . Just)))
327+ (Stream.fold (FL.foldMap (Last . Just)))
329328 , benchIOSink
330329 value
331330 "foldMapM"
332− (S.fold (FL.foldMapM (return . Last . Just)))
333− , benchIOSink value "index" (S.fold (FL.index (value + 1)))
334− , benchIOSink value "head" (S.fold FL.head)
335− , benchIOSink value "find" (S.fold (FL.find (== (value + 1))))
331+ (Stream.fold (FL.foldMapM (return . Last . Just)))
332+ , benchIOSink value "index" (Stream.fold (FL.index (value + 1)))
333+ , benchIOSink value "head" (Stream.fold FL.head)
334+ , benchIOSink value "find" (Stream.fold (FL.find (== (value + 1))))
336335 , benchIOSink
337336 value
338337 "lookup"
339− (S.fold (FL.lmap (\a -> (a, a)) (FL.lookup (value + 1))))
338+ (Stream.fold (FL.lmap (\a -> (a, a)) (FL.lookup (value + 1))))
340339 , benchIOSink
341340 value
342341 "findIndex"
343− (S.fold (FL.findIndex (== (value + 1))))
342+ (Stream.fold (FL.findIndex (== (value + 1))))
344343 , benchIOSink
345344 value
346345 "elemIndex"
347− (S.fold (FL.elemIndex (value + 1)))
348− , benchIOSink value "null" (S.fold FL.null)
349− , benchIOSink value "elem" (S.fold (FL.elem (value + 1)))
350− , benchIOSink value "notElem" (S.fold (FL.notElem (value + 1)))
346+ (Stream.fold (FL.elemIndex (value + 1)))
347+ , benchIOSink value "null" (Stream.fold FL.null)
348+ , benchIOSink value "elem" (Stream.fold (FL.elem (value + 1)))
349+ , benchIOSink value "notElem" (Stream.fold (FL.notElem (value + 1)))
351350 , benchIOSink value "all" $ all value
352351 , benchIOSink value "any" $ any value
353352 , benchIOSink value "take" $ take value
354353 , benchIOSink value "takeEndBy_" $ takeEndBy_ value
355− , benchIOSink value "and" (S.fold FL.and . S.map (<= (value + 1)))
356− , benchIOSink value "or" (S.fold FL.or . S.map (> (value + 1)))
354+ , benchIOSink value "and" (Stream.fold FL.and . fmap (<= (value + 1)))
355+ , benchIOSink value "or" (Stream.fold FL.or . fmap (> (value + 1)))
357356 ]
358357 ]
359358
360359o_1_space_serial_transformation :: Int -> [Benchmark]
361360o_1_space_serial_transformation value =
362361 [ bgroup "transformation"
363− [ benchIOSink value "map" (S.fold (FL.lmap (+ 1) FL.drain))
362+ [ benchIOSink value "map" (Stream.fold (FL.lmap (+ 1) FL.drain))
364363 , let f x = if even x then Just x else Nothing
365364 fld = FL.mapMaybe f FL.drain
366− in benchIOSink value "mapMaybe" (S.fold fld)
365+ in benchIOSink value "mapMaybe" (Stream.fold fld)
367366 , benchIOSink
368367 value
369368 "rsequence"
370− (S.fold (FL.rmapM id (return <$> FL.drain)))
371− , benchIOSink value "rmapM" (S.fold (FL.rmapM return FL.drain))
369+ (Stream.fold (FL.rmapM id (return <$> FL.drain)))
370+ , benchIOSink value "rmapM" (Stream.fold (FL.rmapM return FL.drain))
372371 , benchIOSink
373372 value
374373 "pipe-mapM"
375− (S.fold
374+ (Stream.fold
376375 (FL.transform
377376 (Pipe.mapM (\x -> return $ x + 1))
378377 FL.drain))
379378 , benchIOSink
380379 value
381380 "fold-scan"
382− (S.fold $ FL.scan FL.sum FL.drain)
381+ (Stream.fold $ FL.scan FL.sum FL.drain)
383382 , benchIOSink
384383 value
385384 "fold-scanMany"
386− (S.fold $ FL.scanMany (FL.take 2 FL.drain) FL.drain)
385+ (Stream.fold $ FL.scanMany (FL.take 2 FL.drain) FL.drain)
387386 , benchIOSink
388387 value
389388 "fold-postscan"
390− (S.fold $ FL.postscan FL.sum FL.drain)
389+ (Stream.fold $ FL.postscan FL.sum FL.drain)
391390 ]
392391 ]
393392
@@ -421,7 +420,7 @@ o_1_space_serial_composition value =
421420
422421o_n_space_serial :: Int -> [Benchmark]
423422o_n_space_serial value =
424− [ benchIOSink value "sequence_/100" $ S.fold (sequence_ (value `div` 100))
423+ [ benchIOSink value "sequence_/100" $ Stream.fold (sequence_ (value `div` 100))
425424 ]
426425
427426o_n_heap_serial :: Int -> [Benchmark]
@@ -430,14 +429,14 @@ o_n_heap_serial value =
430429 -- Left folds for building a structure are inherently non-streaming
431430 -- as the structure cannot be lazily consumed until fully built.
432431 [
433− benchIOSink value "toList" (S.fold FL.toList)
434− , benchIOSink value "toListRev" (S.fold FL.toListRev)
432+ benchIOSink value "toList" (Stream.fold FL.toList)
433+ , benchIOSink value "toListRev" (Stream.fold FL.toListRev)
435434 , benchIOSink value "toStream"
436− (S.fold FL.toStream
437− :: SerialT IO a -> IO (SerialT Identity a))
435+ (Stream.fold FL.toStream
436+ :: Stream IO a -> IO (Stream Identity a))
438437 , benchIOSink value "toStreamRev"
439− (S.fold FL.toStreamRev
440− :: SerialT IO a -> IO (SerialT Identity a))
438+ (Stream.fold FL.toStreamRev
439+ :: Stream IO a -> IO (Stream Identity a))
441440 ]
442441 , bgroup "key-value"
443442 [