arrow-fx-coroutines / arrow.fx.coroutines.stream / Stream / mask
fun mask():
Stream
<O>
Behaves like the identity function but halts the stream on an error and does not return the error.
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(1,2,3).append { Stream.raiseError<Int>(RuntimeException()).append { Stream(4, 5, 6) } }
.mask()
.toList().let(::println) //[1, 2, 3]
//sampleEnd
Do you like Arrow?
✖