// ets_tracing: off import type * as T from "../../../../Effect/index.js" import * as CH from "../../Channel/index.js" import * as C from "../core.js" /** * Interrupts the evaluation of this stream when the provided IO completes. The given * IO will be forked as part of this stream, and its success will be discarded. This * combinator will also interrupt any in-progress element being pulled from upstream. * * If the IO completes with a failure before the stream completes, the returned stream * will emit that failure. */ export function interruptWhen_( self: C.Stream, io: T.Effect ): C.Stream { return new C.Stream(CH.interruptWhen_(self.channel, io)) } /** * Interrupts the evaluation of this stream when the provided IO completes. The given * IO will be forked as part of this stream, and its success will be discarded. This * combinator will also interrupt any in-progress element being pulled from upstream. * * If the IO completes with a failure before the stream completes, the returned stream * will emit that failure. * * @ets_data_first interruptWhen_ */ export function interruptWhen(io: T.Effect) { return (self: C.Stream) => interruptWhen_(self, io) }