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

interruptWhen

fun interruptWhen(haltOnSignal: suspend () -> Either<Throwable, Unit>): Stream<O>

Interrupts the stream, when haltOnSignal finishes its evaluation.

fun interruptWhen(haltWhenTrue: Signal<Boolean>): Stream<O>

Alias for interruptWhen(haltWhenTrue.discrete).

fun interruptWhen(haltWhenTrue: Stream<Boolean>): Stream<O>

Let through the s2 branch as long as the s1 branch is false, listening asynchronously for the left branch to become true. This halts as soon as either branch halts.

Consider using the overload that takes a Signal, Deferred or F[Either[Throwable, Unit]].

Do you like Arrow?

Arrow Org
<