arrow-fx-coroutines / arrow.fx.coroutines.stream / terminateOnNone
fun <O>
Stream
<Option<O>>.terminateOnNone():
Stream
<O>
Halts the input stream at the first arrow.core.None.
import arrow.core.Some
import arrow.core.None
import arrow.fx.coroutines.stream.*
//sampleStart
suspend fun main(): Unit =
Stream(Some(1), Some(2), None, Some(3), None)
.terminateOnNone()
.toList()
.let(::println) //[1, 2]
//sampleEnd
Do you like Arrow?
✖