// ets_tracing: off import type { Canceler } from "../Effect/Canceler.js" import { succeedWith } from "../Effect/core.js" import type { IO } from "../Effect/effect.js" import type { Promise } from "./promise.js" import { Pending } from "./state.js" export function interruptJoiner(joiner: (a: IO) => void) { return (promise: Promise): Canceler => succeedWith(() => { const state = promise.state.get if (state._tag === "Pending") { promise.state.set(new Pending(state.joiners.filter((j) => j !== joiner))) } }) }