arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / mapChunks
fun <B> mapChunks(f: (
Chunk
<O>) ->
Chunk
<B>):
Stream
<B>
Applies the specified pure function to each chunk in this stream.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(1, 2, 3).append { Stream(4, 5, 6) }
.mapChunks { ch -> ch.map { it + 1 } }
.toList().let(::println) // [2, 3, 4, 5, 6, 7]
//sampleEnd
Do you like Arrow?
✖