import type { Cause } from "../Cause/cause.js"; import * as Exit from "../Exit/core.js"; import type * as Fiber from "../Fiber/index.js"; import * as O from "../Option/index.js"; import type { Supervisor } from "../Supervisor/index.js"; import type { Effect, IO, RIO, UIO } from "./effect.js"; import type { FailureReporter } from "./primitives.js"; /** * Effectfully accesses the environment of the effect. */ export declare function access(f: (_: R0) => A, __trace?: string): RIO; /** * Effectfully accesses the environment of the effect. */ export declare function accessM(f: (_: R0) => Effect, __trace?: string): Effect; /** * Returns an effect that models the execution of this effect, followed by * the passing of its value to the specified continuation function `f`, * followed by the effect that it returns. * * @ets_data_first chain_ */ export declare function chain(f: (a: A) => Effect, __trace?: string): (val: Effect) => Effect; /** * Returns an effect that models the execution of this effect, followed by * the passing of its value to the specified continuation function `f`, * followed by the effect that it returns. */ export declare function chain_(val: Effect, f: (a: A) => Effect, __trace?: string): Effect; /** * Constructs an effect based on information about the current fiber, such as * its identity. */ export declare function descriptorWith(f: (_: Fiber.Descriptor) => Effect, __trace?: string): Effect; /** * Checks the interrupt status, and produces the effect returned by the * specified callback. */ export declare function checkInterruptible(f: (_: Fiber.InterruptStatus) => Effect, __trace?: string): Effect; /** * Capture trace at the current point */ export declare const trace: UIO; /** * Checks the tracing status, and produces the effect returned by the * specified callback. */ export declare function checkTraced(f: (_: boolean) => Effect): Effect; /** * Disables Effect tracing facilities for the duration of the effect. * * Note: Effect tracing is cached, as such after the first iteration * it has a negligible effect on performance of hot-spots (Additional * hash map lookup per flatMap). As such, using `untraced` sections * is not guaranteed to result in a noticeable performance increase. */ export declare function untraced(self: Effect): Effect; /** * Enables Effect tracing for this effect. Because this is the default, this * operation only has an additional meaning if the effect is located within * an `untraced` section, or the current fiber has been spawned by a parent * inside an `untraced` section. */ export declare function traced(self: Effect): Effect; /** * Imports an asynchronous effect into a pure `Effect` value, possibly returning * the value synchronously. * * If the register function returns a value synchronously, then the callback * function `AsyncRE => void` must not be called. Otherwise the callback * function must be called at most once. * * The list of fibers, that may complete the async callback, is used to * provide better diagnostics. */ export declare function effectAsyncOption(register: (cb: (_: Effect) => void) => O.Option>, __trace?: string): Effect; /** * Imports an asynchronous effect into a pure `Effect` value, possibly returning * the value synchronously. * * If the register function returns a value synchronously, then the callback * function `AsyncRE => void` must not be called. Otherwise the callback * function must be called at most once. * * The list of fibers, that may complete the async callback, is used to * provide better diagnostics. */ export declare function effectAsyncOptionBlockingOn(register: (cb: (_: Effect) => void) => O.Option>, blockingOn: readonly Fiber.FiberID[], __trace?: string): Effect; /** * Imports a synchronous side-effect into a pure value, translating any * thrown exceptions into typed failed effects creating with `halt`. */ export declare function tryCatch(effect: () => A, onThrow: (u: unknown) => E, __trace?: string): IO; /** * Imports a synchronous side-effect into a pure value, translating any * thrown exceptions into typed failed effects creating with `halt`. */ declare function try_(effect: () => A, __trace?: string): IO; export { try_ as try }; /** * Imports a synchronous side-effect into a pure value */ export declare function succeedWith(effect: () => A, __trace?: string): UIO; /** * A more powerful version of `foldM` that allows recovering from any kind of failure except interruptions. * * @ets_data_first foldCauseM_ */ export declare function foldCauseM(failure: (cause: Cause) => Effect, success: (a: A) => Effect, __trace?: string): (value: Effect) => Effect; /** * A more powerful version of `foldM` that allows recovering from any kind of failure except interruptions. */ export declare function foldCauseM_(value: Effect, failure: (cause: Cause) => Effect, success: (a: A) => Effect, __trace?: string): Effect; /** * 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 fork(value: Effect, __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 forkReport_ */ export declare function forkReport(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 forkReport_(value: Effect, reportFailure: FailureReporter, __trace?: string): RIO>; /** * Returns an effect that models failure with the specified `Cause`. */ export declare function halt(cause: Cause, __trace?: string): IO; /** * Returns an effect that models failure with the specified `Cause`. * * This version takes in a lazily-evaluated trace that can be attached to the `Cause` * via `Cause.Traced`. */ export declare function haltWith(cause: (_: () => Fiber.Trace) => Cause, __trace?: string): IO; /** * Switches the interrupt status for this effect. If `true` is used, then the * effect becomes interruptible (the default), while if `false` is used, then * the effect becomes uninterruptible. These changes are compositional, so * they only affect regions of the effect. * * @ets_data_first interruptStatus_ */ export declare function interruptStatus(flag: Fiber.InterruptStatus, __trace?: string): (effect: Effect) => Effect; /** * Switches the interrupt status for this effect. If `true` is used, then the * effect becomes interruptible (the default), while if `false` is used, then * the effect becomes uninterruptible. These changes are compositional, so * they only affect regions of the effect. */ export declare function interruptStatus_(effect: Effect, flag: Fiber.InterruptStatus, __trace?: string): Effect; /** * Toggles Effect tracing support for this effect. If `true` is used, then the * effect will accumulate traces, while if `false` is used, then tracing * is disabled. These changes are compositional, so they only affect regions * of the effect. * * @ets_data_first tracingStatus_ */ export declare function tracingStatus(flag: boolean): (effect: Effect) => Effect; /** * Toggles Effect tracing support for this effect. If `true` is used, then the * effect will accumulate traces, while if `false` is used, then tracing * is disabled. These changes are compositional, so they only affect regions * of the effect. */ export declare function tracingStatus_(effect: Effect, flag: boolean): Effect; /** * Provides the `Effect` effect with its required environment, which eliminates * its dependency on `R`. * * @ets_data_first provideAll_ */ export declare function provideAll(r: R, __trace?: string): (next: Effect) => Effect; /** * Provides the `Effect` effect with its required environment, which eliminates * its dependency on `R`. */ export declare function provideAll_(next: Effect, r: R, __trace?: string): Effect; /** * Returns an effect that semantically runs the effect on a fiber, * producing an `Exit` for the completion value of the fiber. */ export declare function result(value: Effect, __trace?: string): Effect>; /** * Lift a pure value into an effect */ export declare function succeed(a: A, __trace?: string): Effect; /** * Returns an effect with the behavior of this one, but where all child * fibers forked in the effect are reported to the specified supervisor. * * @ets_data_first supervised_ */ export declare function supervised(supervisor: Supervisor, __trace?: string): (fa: Effect) => Effect; /** * Returns an effect with the behavior of this one, but where all child * fibers forked in the effect are reported to the specified supervisor. */ export declare function supervised_(fa: Effect, supervisor: Supervisor, __trace?: string): Effect; /** * Returns a lazily constructed effect, whose construction may itself require effects. * When no environment is required (i.e., when R == unknown) it is conceptually equivalent to `flatten(succeedWith(io))`. */ export declare function suspend(factory: (platform: Fiber.Platform, id: Fiber.FiberID) => Effect, __trace?: string): Effect; /** * Returns a lazily constructed effect, whose construction may itself require effects. * When no environment is required (i.e., when R == unknown) it is conceptually equivalent to `flatten(tryCatch(orThrow, io))`. */ export declare function tryCatchSuspend(factory: (platform: Fiber.Platform, id: Fiber.FiberID) => Effect, onThrow: (u: unknown) => E2, __trace?: string): Effect; /** * Executed `that` in case `self` fails with a `Cause` that doesn't contain defects, * executes `success` in case of successes */ export declare function tryOrElse_(self: Effect, that: () => Effect, success: (a: A) => Effect, __trace?: string): Effect; /** * Executed `that` in case `self` fails with a `Cause` that doesn't contain defects, * executes `success` in case of successes * * @ets_data_first tryOrElse_ */ export declare function tryOrElse(that: () => Effect, success: (a: A) => Effect, __trace?: string): (self: Effect) => Effect; /** * Returns the effect resulting from mapping the success of this effect to unit. */ export declare const unit: UIO; /** * Returns the effect resulting from mapping the success of this effect to unit. */ export declare const unitTraced: (__trace?: string | undefined) => UIO; /** * Returns an effect that yields to the runtime system, starting on a fresh * stack. Manual use of this method can improve fairness, at the cost of * overhead. */ export declare const yieldNow: UIO; /** * Checks the current platform */ export declare function checkPlatform(f: (_: Fiber.Platform) => Effect, __trace?: string): Effect; //# sourceMappingURL=core.d.ts.map