arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / effectMap

effectMap

fun <B> effectMap(f: suspend (O) -> B): Stream<B>

Alias for flatMap { o -> Stream.effect { f(o) } }.

import arrow.fx.coroutines.stream.*

//sampleStart
suspend fun main(): Unit =
  Stream(1, 2, 3)
    .effectMap { print(it) }
    .drain() // 123
//sampleEnd

Do you like Arrow?

Arrow Org
<