import type { Exit } from "../Exit/exit.js"; import type { Runtime } from "../Fiber/core.js"; import type * as Fiber from "../Fiber/index.js"; import type { Scope } from "../Scope/index.js"; import type { Effect, RIO, UIO } from "./effect.js"; import type { FailureReporter } from "./primitives.js"; /** * Retrieves the scope that will be used to supervise forked effects. */ export declare const forkScope: UIO>>; export declare class ForkScopeRestore { private scope; constructor(scope: Scope>); readonly restore: (fa: Effect, __trace?: string | undefined) => Effect; } /** * Captures the fork scope, before overriding it with the specified new * scope, passing a function that allows restoring the fork scope to * what it was originally. */ export declare function forkScopeMask_(newScope: Scope>, f: (restore: ForkScopeRestore) => Effect, __trace?: string): Effect; /** * Captures the fork scope, before overriding it with the specified new * scope, passing a function that allows restoring the fork scope to * what it was originally. * * @ets_data_first forkScopeMask_ */ export declare function forkScopeMask(f: (restore: ForkScopeRestore) => Effect, __trace?: string): (newScope: Scope>) => Effect; /** * Returns an effect that races this effect with the specified effect, calling * the specified finisher as soon as one result or the other has been computed. */ export declare function raceWithScope_(left: Effect, right: Effect, leftWins: (exit: Exit, fiber: Fiber.Fiber) => Effect, rightWins: (exit: Exit, fiber: Fiber.Fiber) => Effect, scope: Scope>, __trace?: string): Effect; /** * Returns an effect that races this effect with the specified effect, calling * the specified finisher as soon as one result or the other has been computed. * * @ets_data_first raceWithScope_ */ export declare function raceWithScope(right: Effect, leftWins: (exit: Exit, fiber: Fiber.Fiber) => Effect, rightWins: (exit: Exit, fiber: Fiber.Fiber) => Effect, scope: Scope>, __trace?: string): (left: Effect) => Effect; /** * Returns an effect that races this effect with the specified effect, calling * the specified finisher as soon as one result or the other has been computed. */ export declare function raceWith_(left: Effect, right: Effect, leftWins: (exit: Exit, fiber: Fiber.Fiber) => Effect, rightWins: (exit: Exit, fiber: Fiber.Fiber) => Effect, __trace?: string): Effect; /** * Returns an effect that races this effect with the specified effect, calling * the specified finisher as soon as one result or the other has been computed. * * @ets_data_first raceWith_ */ export declare function raceWith(right: Effect, leftWins: (exit: Exit, fiber: Fiber.Fiber) => Effect, rightWins: (exit: Exit, fiber: Fiber.Fiber) => Effect, __trace?: string): (left: Effect) => Effect; /** * Graft function */ export declare type Grafter = (effect: Effect, __trace?: string) => Effect; /** * Transplants specified effects so that when those effects fork other * effects, the forked effects will be governed by the scope of the * fiber that executes this effect. * * This can be used to "graft" deep grandchildren onto a higher-level * scope, effectively extending their lifespans into the parent scope. */ export declare function transplant(f: (_: Grafter) => Effect, __trace?: string): Effect; /** * Forks the effect into a new fiber attached to the global scope. Because the * new fiber is attached to the global scope, when the fiber executing the * returned effect terminates, the forked fiber will continue running. */ export declare function forkDaemon(value: Effect, __trace?: string): RIO>; /** * Forks the effect into a new fiber attached to the global scope. Because the * new fiber is attached to the global scope, when the fiber executing the * returned effect terminates, the forked fiber will continue running. * * @ets_data_first forkDaemonReport_ */ export declare function forkDaemonReport(reportFailure: FailureReporter, __trace?: string): (value: Effect) => RIO>; /** * Forks the effect into a new fiber attached to the global scope. Because the * new fiber is attached to the global scope, when the fiber executing the * returned effect terminates, the forked fiber will continue running. */ export declare function forkDaemonReport_(value: Effect, reportFailure: FailureReporter, __trace?: string): RIO>; /** * Returns an effect that forks this effect into its own separate fiber, * returning the fiber immediately, without waiting for it to begin * executing the effect. * * The returned fiber can be used to interrupt the forked fiber, await its * result, or join the fiber. See `Fiber` for more information. * * The fiber is forked with interrupt supervision mode, meaning that when the * fiber that forks the child exits, the child will be interrupted. * * @ets_data_first forkIn_ */ export declare function forkIn(scope: Scope>, __trace?: string): (value: Effect) => RIO>; /** * Returns an effect that forks this effect into its own separate fiber, * returning the fiber immediately, without waiting for it to begin * executing the effect. * * The returned fiber can be used to interrupt the forked fiber, await its * result, or join the fiber. See `Fiber` for more information. * * The fiber is forked with interrupt supervision mode, meaning that when the * fiber that forks the child exits, the child will be interrupted. */ export declare function forkIn_(value: Effect, scope: Scope>, __trace?: string): RIO>; /** * Returns an effect that forks this effect into its own separate fiber, * returning the fiber immediately, without waiting for it to begin * executing the effect. * * The returned fiber can be used to interrupt the forked fiber, await its * result, or join the fiber. See `Fiber` for more information. * * The fiber is forked with interrupt supervision mode, meaning that when the * fiber that forks the child exits, the child will be interrupted. * * @ets_data_first forkInReport_ */ export declare function forkInReport(scope: Scope>, reportFailure: FailureReporter, __trace?: string): (value: Effect) => RIO>; /** * Returns an effect that forks this effect into its own separate fiber, * returning the fiber immediately, without waiting for it to begin * executing the effect. * * The returned fiber can be used to interrupt the forked fiber, await its * result, or join the fiber. See `Fiber` for more information. * * The fiber is forked with interrupt supervision mode, meaning that when the * fiber that forks the child exits, the child will be interrupted. */ export declare function forkInReport_(value: Effect, scope: Scope>, reportFailure: FailureReporter, __trace?: string): RIO>; /** * Retrieves the scope that will be used to supervise forked effects. */ export declare function forkScopeWith(f: (_: Scope>) => Effect, __trace?: string): Effect; /** * Returns a new effect that will utilize the specified scope to supervise * any fibers forked within the original effect. * * @ets_data_first overrideForkScope_ */ export declare function overrideForkScope(scope: Scope>, __trace?: string): (self: Effect) => Effect; /** * Returns a new effect that will utilize the specified scope to supervise * any fibers forked within the original effect. */ export declare function overrideForkScope_(self: Effect, scope: Scope>, __trace?: string): Effect; /** * Returns a new effect that will utilize the default scope (fiber scope) to * supervise any fibers forked within the original effect. */ export declare function resetForkScope(self: Effect, __trace?: string): Effect; //# sourceMappingURL=core-scope.d.ts.map