Hyperlinkv0.8.0-beta.28

Scope

Scope.makeUnsafeconsteffect/Scope.ts:281
(finalizerStrategy?: "sequential" | "parallel"): Closeable

Creates a new Scope synchronously without wrapping it in an Effect. This is useful when you need a scope immediately but should be used with caution as it doesn't provide the same safety guarantees as the Effect-wrapped version.

When to use

Use when a scope must be allocated synchronously and the caller will close it manually.

Example (Creating a scope synchronously)

import { Console, Effect, Exit, Scope } from "effect"

// Create a scope immediately
const scope = Scope.makeUnsafe("sequential")

// Use it in an Effect program
const program = Effect.gen(function*() {
  yield* Scope.addFinalizer(scope, Console.log("Cleanup"))
  yield* Scope.close(scope, Exit.void)
})
constructors
Source effect/Scope.ts:2811 lines
export const makeUnsafe: (finalizerStrategy?: "sequential" | "parallel") => Closeable = effect.scopeMakeUnsafe
Referenced by 10 symbols