Package: effect
Module: Scope
Represents a closed scope state where finalizers have been executed and the scope is no longer accepting new resources.
Example (Inspecting a closed scope state)
import { Effect, Exit, Scope } from "effect"
const program = Effect.gen(function*() {
const scope = yield* Scope.make()
// Close the scope
yield* Scope.close(scope, Exit.succeed("Done"))
// Check if scope is closed
if (scope.state._tag === "Closed") {
console.log("Scope is closed")
console.log(scope.state.exit) // The exit value used to close the scope
}
})
Signature
type Closed = {
readonly _tag: "Closed"
readonly exit: Exit<any, any>
}
Since v4.0.0