Package: effect
Module: Deferred
Attempts to complete the Deferred with interruption by the current fiber.
When to use
Use to complete a Deferred as interrupted by the current fiber.
Details
Fibers waiting on the Deferred are interrupted with the current fiber id
only if this call completes it. The returned effect succeeds with true
when this call completed the Deferred, or false if it was already
completed.
Example (Interrupting a Deferred)
import { Deferred, Effect } from "effect"
const program = Effect.gen(function*() {
const deferred = yield* Deferred.make<number>()
const success = yield* Deferred.interrupt(deferred)
console.log(success) // true
})
Signature
declare const interrupt: <A, E>(self: Deferred<A, E>) => Effect<boolean>
Since v2.0.0