Hyperlinkv0.8.0-beta.28

Effect

Effect.interruptibleMaskconsteffect/Effect.ts:7398
<A, E, R>(
  f: (
    restore: <AX, EX, RX>(
      effect: Effect<AX, EX, RX>
    ) => Effect<AX, EX, RX>
  ) => Effect<A, E, R>
): Effect<A, E, R>

Runs an effect in an interruptible region while providing restore for locally restoring the previous interruptibility.

Example (Controlling interruptibility locally)

import { Console, Effect } from "effect"

const program = Effect.interruptibleMask((restore) =>
  Effect.gen(function*() {
    yield* Console.log("Interruptible phase...")
    yield* Effect.sleep("1 second")

    // Make this part uninterruptible
    yield* restore(
      Effect.gen(function*() {
        yield* Console.log("Uninterruptible phase...")
        yield* Effect.sleep("2 seconds")
      })
    )

    yield* Console.log("Back to interruptible")
  })
)
interruption
Source effect/Effect.ts:73985 lines
export const interruptibleMask: <A, E, R>(
  f: (
    restore: <AX, EX, RX>(effect: Effect<AX, EX, RX>) => Effect<AX, EX, RX>
  ) => Effect<A, E, R>
) => Effect<A, E, R> = internal.interruptibleMask