effect-io-ai

Package: effect
Module: Effect

Effect.interruptible

Returns a new effect that allows the effect to be interruptible.

Example (Allowing interruption)

import { Effect } from "effect"

const longRunning = Effect.forever(Effect.succeed("working..."))

const program = Effect.interruptible(longRunning)

// This effect can now be interrupted
const fiber = Effect.runFork(program)
// Later: fiber.interrupt()

Signature

declare const interruptible: <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>

Source

Since v2.0.0