arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / effectTap
fun effectTap(f: suspend (O) ->
Unit
):
Stream
<O>
Alias for effectMap { o -> f(o); o }
.
Useful if you want to attach log function
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(1, 2, 3)
.effectTap { print(it) } // 123
.toList()
.let(::println) // [1, 2, 3]
//sampleEnd
Do you like Arrow?
✖