arrow-fx-coroutines / arrow.fx.coroutines.stream / foldChunks

foldChunks

suspend fun <O, B> Stream<O>.foldChunks(init: B, f: (B, Chunk<O>) -> B): B

Folds all the effects of this stream in to a value by folding the output chunks together, starting with the provided init and combining the current value with each output chunk using f

This a terminal operator, meaning this functions suspends until the Stream finishes. If any errors are raised while streaming, it’s thrown from this suspend scope.

Do you like Arrow?

Arrow Org
<