import * as Cause from "../Cause/core.js"; import type { Renderer } from "../Cause/Pretty/index.js"; import { HasClock } from "../Clock/index.js"; import type { Exit } from "../Exit/exit.js"; import { FiberContext } from "../Fiber/context.js"; import { Platform } from "../Fiber/platform.js"; import type { Callback } from "../Fiber/state.js"; import { HasRandom } from "../Random/index.js"; import * as Supervisor from "../Supervisor/index.js"; import type { Effect, UIO } from "./effect.js"; import type { FailureReporter } from "./primitives.js"; export declare type DefaultEnv = HasClock & HasRandom; export declare const defaultEnv: DefaultEnv; /** * Effect Canceler */ export declare type AsyncCancel = UIO>; export declare const prettyReporter: FailureReporter; export declare const defaultPlatform: Platform>>; export declare class CustomRuntime { readonly env: R; readonly platform: Platform; constructor(env: R, platform: Platform); private fiberContext; supervised(supervisor: Supervisor.Supervisor): CustomRuntime; runFiber(self: Effect): FiberContext; /** * Runs effect until completion, calling cb with the eventual exit state */ run(self: Effect, cb?: Callback): void; /** * Runs effect until completion returing a cancel effecr that when executed * triggers cancellation of the process */ runCancel(self: Effect, cb?: Callback): AsyncCancel; /** * Run effect as a Promise, throwing a the first error or exception */ runPromise(self: Effect): Promise; /** * Run effect as a Promise of the Exit state * in case of error. */ runPromiseExit(self: Effect): Promise>; withEnvironment(f: (_: R) => R2): CustomRuntime; traceRenderer(renderer: Renderer): CustomRuntime; traceExecution(b: boolean): CustomRuntime; executionTraceLength(n: number): CustomRuntime; traceStack(b: boolean): CustomRuntime; stackTraceLength(n: number): CustomRuntime; traceEffect(b: boolean): CustomRuntime; initialTracingStatus(b: boolean): CustomRuntime; ancestorExecutionTraceLength(n: number): CustomRuntime; ancestorStackTraceLength(n: number): CustomRuntime; ancestryLength(n: number): CustomRuntime; reportFailure(reportFailure: (_: Cause.Cause) => void): CustomRuntime; maxOp(maxOp: number): CustomRuntime; } /** * Construct custom runtime */ export declare function makeCustomRuntime(env: R, platform: Platform): CustomRuntime; /** * Default runtime */ export declare const defaultRuntime: CustomRuntime>>; /** * Exports of default runtime */ export declare const run: (self: Effect, cb?: Callback | undefined) => void, runCancel: (self: Effect, cb?: Callback | undefined) => AsyncCancel, runFiber: (self: Effect) => FiberContext, runPromise: (self: Effect) => Promise, runPromiseExit: (self: Effect) => Promise>; /** * Use current environment to build a runtime that is capable of * providing its content to other effects. * * NOTE: in should be used in a region where current environment * is valid (i.e. keep attention to closed resources) */ export declare function runtime(): Effect>; export declare function withRuntimeM(f: (r: CustomRuntime) => Effect): Effect; export declare function withRuntime(f: (r: CustomRuntime) => A): Effect; //# sourceMappingURL=runtime.d.ts.map