@@ -571,20 +571,28 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F,
571
571
def conflateChunks [F2 [x] >: F [x]: Concurrent ](chunkLimit : Int ): Stream [F2 , Chunk [O ]] =
572
572
Stream .eval(Channel .bounded[F2 , Chunk [O ]](chunkLimit)).flatMap { chan =>
573
573
val producer = chunks.through(chan.sendAll)
574
- val consumer = chan.stream.underlying.unconsFlatMap( chunks => Pull .output1(chunks.iterator.reduce(_ ++ _))).stream
574
+ val consumer = chan.stream.chunks.map(_.combineAll)
575
575
consumer.concurrently(producer)
576
576
}
577
577
578
- def conflate [F2 [x] >: F [x]: Concurrent , O2 ](chunkLimit : Int , zero : O2 )(f : (O2 , O ) => O2 ): Stream [F2 , O2 ] =
578
+ def conflate [F2 [x] >: F [x]: Concurrent , O2 ](chunkLimit : Int , zero : O2 )(
579
+ f : (O2 , O ) => O2
580
+ ): Stream [F2 , O2 ] =
579
581
conflateChunks[F2 ](chunkLimit).map(_.foldLeft(zero)(f))
580
582
581
- def conflate1 [F2 [x] >: F [x]: Concurrent , O2 >: O ](chunkLimit : Int )(f : (O2 , O2 ) => O2 ): Stream [F2 , O2 ] =
583
+ def conflate1 [F2 [x] >: F [x]: Concurrent , O2 >: O ](chunkLimit : Int )(
584
+ f : (O2 , O2 ) => O2
585
+ ): Stream [F2 , O2 ] =
582
586
conflateChunks[F2 ](chunkLimit).map(c => c.drop(1 ).foldLeft(c(0 ): O2 )((x, y) => f(x, y)))
583
587
584
- def conflateSemigroup [F2 [x] >: F [x]: Concurrent , O2 >: O : Semigroup ](chunkLimit : Int ): Stream [F2 , O2 ] =
588
+ def conflateSemigroup [F2 [x] >: F [x]: Concurrent , O2 >: O : Semigroup ](
589
+ chunkLimit : Int
590
+ ): Stream [F2 , O2 ] =
585
591
conflate1[F2 , O2 ](chunkLimit)(Semigroup [O2 ].combine)
586
592
587
- def conflateMap [F2 [x] >: F [x]: Concurrent , O2 : Semigroup ](chunkLimit : Int )(f : O => O2 ): Stream [F2 , O2 ] =
593
+ def conflateMap [F2 [x] >: F [x]: Concurrent , O2 : Semigroup ](chunkLimit : Int )(
594
+ f : O => O2
595
+ ): Stream [F2 , O2 ] =
588
596
map(f).conflateSemigroup[F2 , O2 ](chunkLimit)
589
597
590
598
/** Prepends a chunk onto the front of this stream.
@@ -2419,7 +2427,7 @@ final class Stream[+F[_], +O] private[fs2] (private[fs2] val underlying: Pull[F,
2419
2427
chunks.through(chan.sendAll)
2420
2428
}
2421
2429
}
2422
-
2430
+
2423
2431
/** Prints each element of this stream to standard out, converting each element to a `String` via `Show`. */
2424
2432
def printlns [F2 [x] >: F [x], O2 >: O ](implicit
2425
2433
F : Console [F2 ],
0 commit comments