import type { Channel } from "./Channel.js"; import * as Context from "./Context.js"; import type { Effect, EffectUnify, EffectUnifyIgnore } from "./Effect.js"; import * as Effectable from "./Effectable.js"; import * as Either from "./Either.js"; import type { LazyArg } from "./Function.js"; import type { TypeLambda } from "./HKT.js"; import type { Inspectable } from "./Inspectable.js"; import * as Option from "./Option.js"; import type { Pipeable } from "./Pipeable.js"; import type { Predicate, Refinement } from "./Predicate.js"; import type { Sink } from "./Sink.js"; import type { Stream } from "./Stream.js"; import type { Concurrency, Covariant, Equals, NoExcessProperties, NotFunction, Simplify } from "./Types.js"; import type * as Unify from "./Unify.js"; import { YieldWrap } from "./Utils.js"; /** * @since 3.4.0 * @experimental * @category type ids */ export declare const TypeId: unique symbol; /** * @since 3.4.0 * @experimental * @category type ids */ export type TypeId = typeof TypeId; /** * @since 3.4.0 * @experimental * @category MicroExit */ export declare const MicroExitTypeId: unique symbol; /** * @since 3.4.0 * @experimental * @category MicroExit */ export type MicroExitTypeId = typeof TypeId; /** * A lightweight alternative to the `Effect` data type, with a subset of the functionality. * * @since 3.4.0 * @experimental * @category models */ export interface Micro extends Effect { readonly [TypeId]: Micro.Variance; [Symbol.iterator](): MicroIterator>; [Unify.typeSymbol]?: unknown; [Unify.unifySymbol]?: MicroUnify; [Unify.ignoreSymbol]?: MicroUnifyIgnore; } /** * @category models * @since 3.4.3 */ export interface MicroUnify extends EffectUnify { Micro?: () => A[Unify.typeSymbol] extends Micro | infer _ ? Micro : never; } /** * @category models * @since 3.4.3 */ export interface MicroUnifyIgnore extends EffectUnifyIgnore { Effect?: true; } /** * @category type lambdas * @since 3.4.1 */ export interface MicroTypeLambda extends TypeLambda { readonly type: Micro; } /** * @since 3.4.0 * @experimental */ export declare namespace Micro { /** * @since 3.4.0 * @experimental */ interface Variance { _A: Covariant; _E: Covariant; _R: Covariant; } /** * @since 3.4.0 * @experimental */ type Success = T extends Micro ? _A : never; /** * @since 3.4.0 * @experimental */ type Error = T extends Micro ? _E : never; /** * @since 3.4.0 * @experimental */ type Context = T extends Micro ? _R : never; } /** * @since 3.4.0 * @experimental * @category guards */ export declare const isMicro: (u: unknown) => u is Micro; /** * @since 3.4.0 * @experimental * @category models */ export interface MicroIterator> { next(...args: ReadonlyArray): IteratorResult, Micro.Success>; } /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const MicroCauseTypeId: unique symbol; /** * @since 3.4.6 * @experimental * @category MicroCause */ export type MicroCauseTypeId = typeof MicroCauseTypeId; /** * A `MicroCause` is a data type that represents the different ways a `Micro` can fail. * * **Details** * * `MicroCause` comes in three forms: * * - `Die`: Indicates an unforeseen defect that wasn't planned for in the system's logic. * - `Fail`: Covers anticipated errors that are recognized and typically handled within the application. * - `Interrupt`: Signifies an operation that has been purposefully stopped. * * @since 3.4.6 * @experimental * @category MicroCause */ export type MicroCause = MicroCause.Die | MicroCause.Fail | MicroCause.Interrupt; /** * @since 3.6.6 * @experimental * @category guards */ export declare const isMicroCause: (self: unknown) => self is MicroCause; /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare namespace MicroCause { /** * @since 3.4.6 * @experimental */ type Error = T extends MicroCause.Fail ? E : never; /** * @since 3.4.0 * @experimental */ interface Proto extends Pipeable, globalThis.Error { readonly [MicroCauseTypeId]: { _E: Covariant; }; readonly _tag: Tag; readonly traces: ReadonlyArray; } /** * @since 3.4.6 * @experimental * @category MicroCause */ interface Die extends Proto<"Die", never> { readonly defect: unknown; } /** * @since 3.4.6 * @experimental * @category MicroCause */ interface Fail extends Proto<"Fail", E> { readonly error: E; } /** * @since 3.4.6 * @experimental * @category MicroCause */ interface Interrupt extends Proto<"Interrupt", never> { } } /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const causeFail: (error: E, traces?: ReadonlyArray) => MicroCause; /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const causeDie: (defect: unknown, traces?: ReadonlyArray) => MicroCause; /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const causeInterrupt: (traces?: ReadonlyArray) => MicroCause; /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const causeIsFail: (self: MicroCause) => self is MicroCause.Fail; /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const causeIsDie: (self: MicroCause) => self is MicroCause.Die; /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const causeIsInterrupt: (self: MicroCause) => self is MicroCause.Interrupt; /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const causeSquash: (self: MicroCause) => unknown; /** * @since 3.4.6 * @experimental * @category MicroCause */ export declare const causeWithTrace: { /** * @since 3.4.6 * @experimental * @category MicroCause */ (trace: string): (self: MicroCause) => MicroCause; /** * @since 3.4.6 * @experimental * @category MicroCause */ (self: MicroCause, trace: string): MicroCause; }; /** * @since 3.11.0 * @experimental * @category MicroFiber */ export declare const MicroFiberTypeId: unique symbol; /** * @since 3.11.0 * @experimental * @category MicroFiber */ export type MicroFiberTypeId = typeof MicroFiberTypeId; /** * @since 3.11.0 * @experimental * @category MicroFiber */ export interface MicroFiber { readonly [MicroFiberTypeId]: MicroFiber.Variance; readonly currentOpCount: number; readonly getRef: (ref: Context.Reference) => A; readonly context: Context.Context; readonly addObserver: (cb: (exit: MicroExit) => void) => () => void; readonly unsafeInterrupt: () => void; readonly unsafePoll: () => MicroExit | undefined; } /** * @since 3.11.0 * @experimental * @category MicroFiber */ export declare namespace MicroFiber { /** * @since 3.11.0 * @experimental * @category MicroFiber */ interface Variance { readonly _A: Covariant; readonly _E: Covariant; } } declare class MicroFiberImpl implements MicroFiber { context: Context.Context; interruptible: boolean; readonly [MicroFiberTypeId]: MicroFiber.Variance; readonly _stack: Array; readonly _observers: Array<(exit: MicroExit) => void>; _exit: MicroExit | undefined; _children: Set> | undefined; currentOpCount: number; constructor(context: Context.Context, interruptible?: boolean); getRef(ref: Context.Reference): A; addObserver(cb: (exit: MicroExit) => void): () => void; _interrupted: boolean; unsafeInterrupt(): void; unsafePoll(): MicroExit | undefined; evaluate(effect: Primitive): void; runLoop(effect: Primitive): MicroExit | Yield; getCont(symbol: S): (Primitive & Record Primitive>) | undefined; _yielded: MicroExit | (() => void) | undefined; yieldWith(value: MicroExit | (() => void)): Yield; children(): Set>; } /** * @since 3.11.0 * @experimental * @category MicroFiber */ export declare const fiberAwait: (self: MicroFiber) => Micro>; /** * @since 3.11.2 * @experimental * @category MicroFiber */ export declare const fiberJoin: (self: MicroFiber) => Micro; /** * @since 3.11.0 * @experimental * @category MicroFiber */ export declare const fiberInterrupt: (self: MicroFiber) => Micro; /** * @since 3.11.0 * @experimental * @category MicroFiber */ export declare const fiberInterruptAll: >>(fibers: A) => Micro; declare const identifier: unique symbol; type identifier = typeof identifier; declare const evaluate: unique symbol; type evaluate = typeof evaluate; declare const successCont: unique symbol; type successCont = typeof successCont; declare const failureCont: unique symbol; type failureCont = typeof failureCont; declare const ensureCont: unique symbol; type ensureCont = typeof ensureCont; declare const Yield: unique symbol; type Yield = typeof Yield; interface Primitive { readonly [identifier]: string; readonly [successCont]: ((value: unknown, fiber: MicroFiberImpl) => Primitive | Yield) | undefined; readonly [failureCont]: ((cause: MicroCause, fiber: MicroFiberImpl) => Primitive | Yield) | undefined; readonly [ensureCont]: ((fiber: MicroFiberImpl) => ((value: unknown, fiber: MicroFiberImpl) => Primitive | Yield) | undefined) | undefined; [evaluate](fiber: MicroFiberImpl): Primitive | Yield; } /** * Creates a `Micro` effect that will succeed with the specified constant value. * * @since 3.4.0 * @experimental * @category constructors */ export declare const succeed: (value: A) => Micro; /** * Creates a `Micro` effect that will fail with the specified `MicroCause`. * * @since 3.4.6 * @experimental * @category constructors */ export declare const failCause: (cause: MicroCause) => Micro; /** * Creates a `Micro` effect that fails with the given error. * * This results in a `Fail` variant of the `MicroCause` type, where the error is * tracked at the type level. * * @since 3.4.0 * @experimental * @category constructors */ export declare const fail: (error: E) => Micro; /** * Creates a `Micro` effect that succeeds with a lazily evaluated value. * * If the evaluation of the value throws an error, the effect will fail with a * `Die` variant of the `MicroCause` type. * * @since 3.4.0 * @experimental * @category constructors */ export declare const sync: (evaluate: LazyArg) => Micro; /** * Lazily creates a `Micro` effect from the given side-effect. * * @since 3.4.0 * @experimental * @category constructors */ export declare const suspend: (evaluate: LazyArg>) => Micro; /** * Pause the execution of the current `Micro` effect, and resume it on the next * scheduler tick. * * @since 3.4.0 * @experimental * @category constructors */ export declare const yieldNowWith: (priority?: number) => Micro; /** * Pause the execution of the current `Micro` effect, and resume it on the next * scheduler tick. * * @since 3.4.0 * @experimental * @category constructors */ export declare const yieldNow: Micro; /** * Creates a `Micro` effect that will succeed with the value wrapped in `Some`. * * @since 3.4.0 * @experimental * @category constructors */ export declare const succeedSome: (a: A) => Micro>; /** * Creates a `Micro` effect that succeeds with `None`. * * @since 3.4.0 * @experimental * @category constructors */ export declare const succeedNone: Micro>; /** * Creates a `Micro` effect that will fail with the lazily evaluated `MicroCause`. * * @since 3.4.0 * @experimental * @category constructors */ export declare const failCauseSync: (evaluate: LazyArg>) => Micro; /** * Creates a `Micro` effect that will die with the specified error. * * This results in a `Die` variant of the `MicroCause` type, where the error is * not tracked at the type level. * * @since 3.4.0 * @experimental * @category constructors */ export declare const die: (defect: unknown) => Micro; /** * Creates a `Micro` effect that will fail with the lazily evaluated error. * * This results in a `Fail` variant of the `MicroCause` type, where the error is * tracked at the type level. * * @since 3.4.6 * @experimental * @category constructors */ export declare const failSync: (error: LazyArg) => Micro; /** * Converts an `Option` into a `Micro` effect, that will fail with * `NoSuchElementException` if the option is `None`. Otherwise, it will succeed with the * value of the option. * * @since 3.4.0 * @experimental * @category constructors */ export declare const fromOption: (option: Option.Option) => Micro; /** * Converts an `Either` into a `Micro` effect, that will fail with the left side * of the either if it is a `Left`. Otherwise, it will succeed with the right * side of the either. * * @since 3.4.0 * @experimental * @category constructors */ export declare const fromEither: (either: Either.Either) => Micro; declare const void_: Micro; export { /** * A `Micro` effect that will succeed with `void` (`undefined`). * * @since 3.4.0 * @experimental * @category constructors */ void_ as void }; declare const try_: (options: { try: LazyArg; catch: (error: unknown) => E; }) => Micro; export { /** * The `Micro` equivalent of a try / catch block, which allows you to map * thrown errors to a specific error type. * * @example * ```ts * import { Micro } from "effect" * * Micro.try({ * try: () => { throw new Error("boom") }, * catch: (cause) => new Error("caught", { cause }) * }) * ``` * * @since 3.4.0 * @experimental * @category constructors */ try_ as try }; /** * Wrap a `Promise` into a `Micro` effect. * * Any errors will result in a `Die` variant of the `MicroCause` type, where the * error is not tracked at the type level. * * @since 3.4.0 * @experimental * @category constructors */ export declare const promise: (evaluate: (signal: AbortSignal) => PromiseLike) => Micro; /** * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and * converted into a specific error type. * * @example * ```ts * import { Micro } from "effect" * * Micro.tryPromise({ * try: () => Promise.resolve("success"), * catch: (cause) => new Error("caught", { cause }) * }) * ``` * * @since 3.4.0 * @experimental * @category constructors */ export declare const tryPromise: (options: { readonly try: (signal: AbortSignal) => PromiseLike; readonly catch: (error: unknown) => E; }) => Micro; /** * Create a `Micro` effect using the current `MicroFiber`. * * @since 3.4.0 * @experimental * @category constructors */ export declare const withMicroFiber: (evaluate: (fiber: MicroFiberImpl) => Micro) => Micro; /** * Flush any yielded effects that are waiting to be executed. * * @since 3.4.0 * @experimental * @category constructors */ export declare const yieldFlush: Micro; /** * Create a `Micro` effect from an asynchronous computation. * * You can return a cleanup effect that will be run when the effect is aborted. * It is also passed an `AbortSignal` that is triggered when the effect is * aborted. * * @since 3.4.0 * @experimental * @category constructors */ export declare const async: (register: (resume: (effect: Micro) => void, signal: AbortSignal) => void | Micro) => Micro; /** * A `Micro` that will never succeed or fail. It wraps `setInterval` to prevent * the Javascript runtime from exiting. * * @since 3.4.0 * @experimental * @category constructors */ export declare const never: Micro; /** * @since 3.4.0 * @experimental * @category constructors */ export declare const gen: >, AEff>(...args: [self: Self, body: (this: Self) => Generator] | [body: () => Generator]) => Micro>] ? E : never, [Eff] extends [never] ? never : [Eff] extends [YieldWrap>] ? R : never>; /** * Create a `Micro` effect that will replace the success value of the given * effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const as: { /** * Create a `Micro` effect that will replace the success value of the given * effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (value: B): (self: Micro) => Micro; /** * Create a `Micro` effect that will replace the success value of the given * effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (self: Micro, value: B): Micro; }; /** * Wrap the success value of this `Micro` effect in a `Some`. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const asSome: (self: Micro) => Micro, E, R>; /** * Swap the error and success types of the `Micro` effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const flip: (self: Micro) => Micro; /** * A more flexible version of `flatMap` that combines `map` and `flatMap` into a * single API. * * It also lets you directly pass a `Micro` effect, which will be executed after * the current effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const andThen: { /** * A more flexible version of `flatMap` that combines `map` and `flatMap` into a * single API. * * It also lets you directly pass a `Micro` effect, which will be executed after * the current effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (f: (a: A) => X): (self: Micro) => [X] extends [Micro] ? Micro : Micro; /** * A more flexible version of `flatMap` that combines `map` and `flatMap` into a * single API. * * It also lets you directly pass a `Micro` effect, which will be executed after * the current effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (f: NotFunction): (self: Micro) => [X] extends [Micro] ? Micro : Micro; /** * A more flexible version of `flatMap` that combines `map` and `flatMap` into a * single API. * * It also lets you directly pass a `Micro` effect, which will be executed after * the current effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (self: Micro, f: (a: A) => X): [X] extends [Micro] ? Micro : Micro; /** * A more flexible version of `flatMap` that combines `map` and `flatMap` into a * single API. * * It also lets you directly pass a `Micro` effect, which will be executed after * the current effect. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (self: Micro, f: NotFunction): [X] extends [Micro] ? Micro : Micro; }; /** * Execute a side effect from the success value of the `Micro` effect. * * It is similar to the `andThen` api, but the success value is ignored. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const tap: { /** * Execute a side effect from the success value of the `Micro` effect. * * It is similar to the `andThen` api, but the success value is ignored. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (f: (a: NoInfer) => X): (self: Micro) => [X] extends [Micro] ? Micro : Micro; /** * Execute a side effect from the success value of the `Micro` effect. * * It is similar to the `andThen` api, but the success value is ignored. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (f: NotFunction): (self: Micro) => [X] extends [Micro] ? Micro : Micro; /** * Execute a side effect from the success value of the `Micro` effect. * * It is similar to the `andThen` api, but the success value is ignored. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (self: Micro, f: (a: NoInfer) => X): [X] extends [Micro] ? Micro : Micro; /** * Execute a side effect from the success value of the `Micro` effect. * * It is similar to the `andThen` api, but the success value is ignored. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (self: Micro, f: NotFunction): [X] extends [Micro] ? Micro : Micro; }; /** * Replace the success value of the `Micro` effect with `void`. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const asVoid: (self: Micro) => Micro; /** * Access the `MicroExit` of the given `Micro` effect. * * @since 3.4.6 * @experimental * @category mapping & sequencing */ export declare const exit: (self: Micro) => Micro, never, R>; /** * Replace the error type of the given `Micro` with the full `MicroCause` object. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const sandbox: (self: Micro) => Micro, R>; /** * Returns an effect that races all the specified effects, * yielding the value of the first effect to succeed with a value. Losers of * the race will be interrupted immediately * * @since 3.4.0 * @experimental * @category sequencing */ export declare const raceAll: >(all: Iterable) => Micro, Micro.Error, Micro.Context>; /** * Returns an effect that races all the specified effects, * yielding the value of the first effect to succeed or fail. Losers of * the race will be interrupted immediately. * * @since 3.4.0 * @experimental * @category sequencing */ export declare const raceAllFirst: >(all: Iterable) => Micro, Micro.Error, Micro.Context>; /** * Returns an effect that races two effects, yielding the value of the first * effect to succeed. Losers of the race will be interrupted immediately. * * @since 3.4.0 * @experimental * @category sequencing */ export declare const race: { /** * Returns an effect that races two effects, yielding the value of the first * effect to succeed. Losers of the race will be interrupted immediately. * * @since 3.4.0 * @experimental * @category sequencing */ (that: Micro): (self: Micro) => Micro; /** * Returns an effect that races two effects, yielding the value of the first * effect to succeed. Losers of the race will be interrupted immediately. * * @since 3.4.0 * @experimental * @category sequencing */ (self: Micro, that: Micro): Micro; }; /** * Returns an effect that races two effects, yielding the value of the first * effect to succeed *or* fail. Losers of the race will be interrupted immediately. * * @since 3.4.0 * @experimental * @category sequencing */ export declare const raceFirst: { /** * Returns an effect that races two effects, yielding the value of the first * effect to succeed *or* fail. Losers of the race will be interrupted immediately. * * @since 3.4.0 * @experimental * @category sequencing */ (that: Micro): (self: Micro) => Micro; /** * Returns an effect that races two effects, yielding the value of the first * effect to succeed *or* fail. Losers of the race will be interrupted immediately. * * @since 3.4.0 * @experimental * @category sequencing */ (self: Micro, that: Micro): Micro; }; /** * Map the success value of this `Micro` effect to another `Micro` effect, then * flatten the result. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const flatMap: { /** * Map the success value of this `Micro` effect to another `Micro` effect, then * flatten the result. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (f: (a: A) => Micro): (self: Micro) => Micro; /** * Map the success value of this `Micro` effect to another `Micro` effect, then * flatten the result. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (self: Micro, f: (a: A) => Micro): Micro; }; /** * Flattens any nested `Micro` effects, merging the error and requirement types. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const flatten: (self: Micro, E2, R2>) => Micro; /** * Transforms the success value of the `Micro` effect with the specified * function. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ export declare const map: { /** * Transforms the success value of the `Micro` effect with the specified * function. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (f: (a: A) => B): (self: Micro) => Micro; /** * Transforms the success value of the `Micro` effect with the specified * function. * * @since 3.4.0 * @experimental * @category mapping & sequencing */ (self: Micro, f: (a: A) => B): Micro; }; /** * The `MicroExit` type is used to represent the result of a `Micro` computation. It * can either be successful, containing a value of type `A`, or it can fail, * containing an error of type `E` wrapped in a `MicroCause`. * * @since 3.4.6 * @experimental * @category MicroExit */ export type MicroExit = MicroExit.Success | MicroExit.Failure; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare namespace MicroExit { /** * @since 3.4.6 * @experimental * @category MicroExit */ interface Proto extends Micro { readonly [MicroExitTypeId]: MicroExitTypeId; } /** * @since 3.4.6 * @experimental * @category MicroExit */ interface Success extends Proto { readonly _tag: "Success"; readonly value: A; } /** * @since 3.4.6 * @experimental * @category MicroExit */ interface Failure extends Proto { readonly _tag: "Failure"; readonly cause: MicroCause; } } /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const isMicroExit: (u: unknown) => u is MicroExit; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitSucceed: (a: A) => MicroExit; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitFailCause: (cause: MicroCause) => MicroExit; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitInterrupt: MicroExit; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitFail: (e: E) => MicroExit; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitDie: (defect: unknown) => MicroExit; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitIsSuccess: (self: MicroExit) => self is MicroExit.Success; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitIsFailure: (self: MicroExit) => self is MicroExit.Failure; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitIsInterrupt: (self: MicroExit) => self is MicroExit.Failure & { readonly cause: MicroCause.Interrupt; }; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitIsFail: (self: MicroExit) => self is MicroExit.Failure & { readonly cause: MicroCause.Fail; }; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitIsDie: (self: MicroExit) => self is MicroExit.Failure & { readonly cause: MicroCause.Die; }; /** * @since 3.4.6 * @experimental * @category MicroExit */ export declare const exitVoid: MicroExit; /** * @since 3.11.0 * @experimental * @category MicroExit */ export declare const exitVoidAll: >>(exits: I) => MicroExit> ? _E : never>; /** * @since 3.5.9 * @experimental * @category scheduler */ export interface MicroScheduler { readonly scheduleTask: (task: () => void, priority: number) => void; readonly shouldYield: (fiber: MicroFiber) => boolean; readonly flush: () => void; } /** * @since 3.5.9 * @experimental * @category scheduler */ export declare class MicroSchedulerDefault implements MicroScheduler { private tasks; private running; /** * @since 3.5.9 */ scheduleTask(task: () => void, _priority: number): void; /** * @since 3.5.9 */ afterScheduled: () => void; /** * @since 3.5.9 */ runTasks(): void; /** * @since 3.5.9 */ shouldYield(fiber: MicroFiber): boolean; /** * @since 3.5.9 */ flush(): void; } /** * Access the given `Context.Tag` from the environment. * * @since 3.4.0 * @experimental * @category environment */ export declare const service: { /** * Access the given `Context.Tag` from the environment. * * @since 3.4.0 * @experimental * @category environment */ (tag: Context.Reference): Micro; /** * Access the given `Context.Tag` from the environment. * * @since 3.4.0 * @experimental * @category environment */ (tag: Context.Tag): Micro; }; /** * Access the given `Context.Tag` from the environment, without tracking the * dependency at the type level. * * It will return an `Option` of the service, depending on whether it is * available in the environment or not. * * @since 3.4.0 * @experimental * @category environment */ export declare const serviceOption: (tag: Context.Tag) => Micro>; /** * Update the Context with the given mapping function. * * @since 3.11.0 * @experimental * @category environment */ export declare const updateContext: { /** * Update the Context with the given mapping function. * * @since 3.11.0 * @experimental * @category environment */ (f: (context: Context.Context) => Context.Context>): (self: Micro) => Micro; /** * Update the Context with the given mapping function. * * @since 3.11.0 * @experimental * @category environment */ (self: Micro, f: (context: Context.Context) => Context.Context>): Micro; }; /** * Update the service for the given `Context.Tag` in the environment. * * @since 3.11.0 * @experimental * @category environment */ export declare const updateService: { /** * Update the service for the given `Context.Tag` in the environment. * * @since 3.11.0 * @experimental * @category environment */ (tag: Context.Reference, f: (value: A) => A): (self: Micro) => Micro; /** * Update the service for the given `Context.Tag` in the environment. * * @since 3.11.0 * @experimental * @category environment */ (tag: Context.Tag, f: (value: A) => A): (self: Micro) => Micro; /** * Update the service for the given `Context.Tag` in the environment. * * @since 3.11.0 * @experimental * @category environment */ (self: Micro, tag: Context.Reference, f: (value: A) => A): Micro; /** * Update the service for the given `Context.Tag` in the environment. * * @since 3.11.0 * @experimental * @category environment */ (self: Micro, tag: Context.Tag, f: (value: A) => A): Micro; }; /** * Access the current `Context` from the environment. * * @since 3.4.0 * @experimental * @category environment */ export declare const context: () => Micro>; /** * Merge the given `Context` with the current context. * * @since 3.4.0 * @experimental * @category environment */ export declare const provideContext: { /** * Merge the given `Context` with the current context. * * @since 3.4.0 * @experimental * @category environment */ (context: Context.Context): (self: Micro) => Micro>; /** * Merge the given `Context` with the current context. * * @since 3.4.0 * @experimental * @category environment */ (self: Micro, context: Context.Context): Micro>; }; /** * Add the provided service to the current context. * * @since 3.4.0 * @experimental * @category environment */ export declare const provideService: { /** * Add the provided service to the current context. * * @since 3.4.0 * @experimental * @category environment */ (tag: Context.Tag, service: S): (self: Micro) => Micro>; /** * Add the provided service to the current context. * * @since 3.4.0 * @experimental * @category environment */ (self: Micro, tag: Context.Tag, service: S): Micro>; }; /** * Create a service using the provided `Micro` effect, and add it to the * current context. * * @since 3.4.6 * @experimental * @category environment */ export declare const provideServiceEffect: { /** * Create a service using the provided `Micro` effect, and add it to the * current context. * * @since 3.4.6 * @experimental * @category environment */ (tag: Context.Tag, acquire: Micro): (self: Micro) => Micro | R2>; /** * Create a service using the provided `Micro` effect, and add it to the * current context. * * @since 3.4.6 * @experimental * @category environment */ (self: Micro, tag: Context.Tag, acquire: Micro): Micro | R2>; }; declare const MaxOpsBeforeYield_base: Context.ReferenceClass; /** * @since 3.11.0 * @experimental * @category references */ export declare class MaxOpsBeforeYield extends MaxOpsBeforeYield_base { } declare const CurrentConcurrency_base: Context.ReferenceClass; /** * @since 3.11.0 * @experimental * @category environment refs */ export declare class CurrentConcurrency extends CurrentConcurrency_base { } declare const CurrentScheduler_base: Context.ReferenceClass; /** * @since 3.11.0 * @experimental * @category environment refs */ export declare class CurrentScheduler extends CurrentScheduler_base { } /** * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this * api to control the concurrency of that `Micro` when it is run. * * @example * ```ts * import * as Micro from "effect/Micro" * * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), { * concurrency: "inherit" * }).pipe( * Micro.withConcurrency(2) // use a concurrency of 2 * ) * ``` * * @since 3.4.0 * @experimental * @category environment refs */ export declare const withConcurrency: { /** * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this * api to control the concurrency of that `Micro` when it is run. * * @example * ```ts * import * as Micro from "effect/Micro" * * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), { * concurrency: "inherit" * }).pipe( * Micro.withConcurrency(2) // use a concurrency of 2 * ) * ``` * * @since 3.4.0 * @experimental * @category environment refs */ (concurrency: "unbounded" | number): (self: Micro) => Micro; /** * If you have a `Micro` that uses `concurrency: "inherit"`, you can use this * api to control the concurrency of that `Micro` when it is run. * * @example * ```ts * import * as Micro from "effect/Micro" * * Micro.forEach([1, 2, 3], (n) => Micro.succeed(n), { * concurrency: "inherit" * }).pipe( * Micro.withConcurrency(2) // use a concurrency of 2 * ) * ``` * * @since 3.4.0 * @experimental * @category environment refs */ (self: Micro, concurrency: "unbounded" | number): Micro; }; /** * Combine two `Micro` effects into a single effect that produces a tuple of * their results. * * @since 3.4.0 * @experimental * @category zipping */ export declare const zip: { /** * Combine two `Micro` effects into a single effect that produces a tuple of * their results. * * @since 3.4.0 * @experimental * @category zipping */ (that: Micro, options?: { readonly concurrent?: boolean | undefined; } | undefined): (self: Micro) => Micro<[A, A2], E2 | E, R2 | R>; /** * Combine two `Micro` effects into a single effect that produces a tuple of * their results. * * @since 3.4.0 * @experimental * @category zipping */ (self: Micro, that: Micro, options?: { readonly concurrent?: boolean | undefined; }): Micro<[A, A2], E | E2, R | R2>; }; /** * The `Micro.zipWith` function combines two `Micro` effects and allows you to * apply a function to the results of the combined effects, transforming them * into a single value. * * @since 3.4.3 * @experimental * @category zipping */ export declare const zipWith: { /** * The `Micro.zipWith` function combines two `Micro` effects and allows you to * apply a function to the results of the combined effects, transforming them * into a single value. * * @since 3.4.3 * @experimental * @category zipping */ (that: Micro, f: (a: A, b: A2) => B, options?: { readonly concurrent?: boolean | undefined; }): (self: Micro) => Micro; /** * The `Micro.zipWith` function combines two `Micro` effects and allows you to * apply a function to the results of the combined effects, transforming them * into a single value. * * @since 3.4.3 * @experimental * @category zipping */ (self: Micro, that: Micro, f: (a: A, b: A2) => B, options?: { readonly concurrent?: boolean | undefined; }): Micro; }; /** * Filter the specified effect with the provided function, failing with specified * `MicroCause` if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ export declare const filterOrFailCause: { /** * Filter the specified effect with the provided function, failing with specified * `MicroCause` if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (refinement: Refinement, orFailWith: (a: NoInfer) => MicroCause): (self: Micro) => Micro; /** * Filter the specified effect with the provided function, failing with specified * `MicroCause` if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (predicate: Predicate>, orFailWith: (a: NoInfer) => MicroCause): (self: Micro) => Micro; /** * Filter the specified effect with the provided function, failing with specified * `MicroCause` if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (self: Micro, refinement: Refinement, orFailWith: (a: A) => MicroCause): Micro; /** * Filter the specified effect with the provided function, failing with specified * `MicroCause` if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (self: Micro, predicate: Predicate, orFailWith: (a: A) => MicroCause): Micro; }; /** * Filter the specified effect with the provided function, failing with specified * error if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ export declare const filterOrFail: { /** * Filter the specified effect with the provided function, failing with specified * error if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (refinement: Refinement, orFailWith: (a: NoInfer) => E2): (self: Micro) => Micro; /** * Filter the specified effect with the provided function, failing with specified * error if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (predicate: Predicate>, orFailWith: (a: NoInfer) => E2): (self: Micro) => Micro; /** * Filter the specified effect with the provided function, failing with specified * error if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (self: Micro, refinement: Refinement, orFailWith: (a: A) => E2): Micro; /** * Filter the specified effect with the provided function, failing with specified * error if the predicate fails. * * In addition to the filtering capabilities discussed earlier, you have the option to further * refine and narrow down the type of the success channel by providing a * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (self: Micro, predicate: Predicate, orFailWith: (a: A) => E2): Micro; }; /** * The moral equivalent of `if (p) exp`. * * @since 3.4.0 * @experimental * @category filtering & conditionals */ export declare const when: { /** * The moral equivalent of `if (p) exp`. * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (condition: LazyArg | Micro): (self: Micro) => Micro, E | E2, R | R2>; /** * The moral equivalent of `if (p) exp`. * * @since 3.4.0 * @experimental * @category filtering & conditionals */ (self: Micro, condition: LazyArg | Micro): Micro, E | E2, R | R2>; }; /** * Repeat the given `Micro` using the provided options. * * The `while` predicate will be checked after each iteration, and can use the * fall `MicroExit` of the effect to determine if the repetition should continue. * * @since 3.4.6 * @experimental * @category repetition */ export declare const repeatExit: { /** * Repeat the given `Micro` using the provided options. * * The `while` predicate will be checked after each iteration, and can use the * fall `MicroExit` of the effect to determine if the repetition should continue. * * @since 3.4.6 * @experimental * @category repetition */ (options: { while: Predicate>; times?: number | undefined; schedule?: MicroSchedule | undefined; }): (self: Micro) => Micro; /** * Repeat the given `Micro` using the provided options. * * The `while` predicate will be checked after each iteration, and can use the * fall `MicroExit` of the effect to determine if the repetition should continue. * * @since 3.4.6 * @experimental * @category repetition */ (self: Micro, options: { while: Predicate>; times?: number | undefined; schedule?: MicroSchedule | undefined; }): Micro; }; /** * Repeat the given `Micro` effect using the provided options. Only successful * results will be repeated. * * @since 3.4.0 * @experimental * @category repetition */ export declare const repeat: { /** * Repeat the given `Micro` effect using the provided options. Only successful * results will be repeated. * * @since 3.4.0 * @experimental * @category repetition */ (options?: { while?: Predicate | undefined; times?: number | undefined; schedule?: MicroSchedule | undefined; } | undefined): (self: Micro) => Micro; /** * Repeat the given `Micro` effect using the provided options. Only successful * results will be repeated. * * @since 3.4.0 * @experimental * @category repetition */ (self: Micro, options?: { while?: Predicate | undefined; times?: number | undefined; schedule?: MicroSchedule | undefined; } | undefined): Micro; }; /** * Replicates the given effect `n` times. * * @since 3.11.0 * @experimental * @category repetition */ export declare const replicate: { /** * Replicates the given effect `n` times. * * @since 3.11.0 * @experimental * @category repetition */ (n: number): (self: Micro) => Array>; /** * Replicates the given effect `n` times. * * @since 3.11.0 * @experimental * @category repetition */ (self: Micro, n: number): Array>; }; /** * Performs this effect the specified number of times and collects the * results. * * @since 3.11.0 * @category repetition */ export declare const replicateEffect: { /** * Performs this effect the specified number of times and collects the * results. * * @since 3.11.0 * @category repetition */ (n: number, options?: { readonly concurrency?: Concurrency | undefined; readonly discard?: false | undefined; }): (self: Micro) => Micro, E, R>; /** * Performs this effect the specified number of times and collects the * results. * * @since 3.11.0 * @category repetition */ (n: number, options: { readonly concurrency?: Concurrency | undefined; readonly discard: true; }): (self: Micro) => Micro; /** * Performs this effect the specified number of times and collects the * results. * * @since 3.11.0 * @category repetition */ (self: Micro, n: number, options?: { readonly concurrency?: Concurrency | undefined; readonly discard?: false | undefined; }): Micro, E, R>; /** * Performs this effect the specified number of times and collects the * results. * * @since 3.11.0 * @category repetition */ (self: Micro, n: number, options: { readonly concurrency?: Concurrency | undefined; readonly discard: true; }): Micro; }; /** * Repeat the given `Micro` effect forever, only stopping if the effect fails. * * @since 3.4.0 * @experimental * @category repetition */ export declare const forever: (self: Micro) => Micro; /** * The `MicroSchedule` type represents a function that can be used to calculate * the delay between repeats. * * The function takes the current attempt number and the elapsed time since the * first attempt, and returns the delay for the next attempt. If the function * returns `None`, the repetition will stop. * * @since 3.4.6 * @experimental * @category scheduling */ export type MicroSchedule = (attempt: number, elapsed: number) => Option.Option; /** * Create a `MicroSchedule` that will stop repeating after the specified number * of attempts. * * @since 3.4.6 * @experimental * @category scheduling */ export declare const scheduleRecurs: (n: number) => MicroSchedule; /** * Create a `MicroSchedule` that will generate a constant delay. * * @since 3.4.6 * @experimental * @category scheduling */ export declare const scheduleSpaced: (millis: number) => MicroSchedule; /** * Create a `MicroSchedule` that will generate a delay with an exponential backoff. * * @since 3.4.6 * @experimental * @category scheduling */ export declare const scheduleExponential: (baseMillis: number, factor?: number) => MicroSchedule; /** * Returns a new `MicroSchedule` with an added calculated delay to each delay * returned by this schedule. * * @since 3.4.6 * @experimental * @category scheduling */ export declare const scheduleAddDelay: { /** * Returns a new `MicroSchedule` with an added calculated delay to each delay * returned by this schedule. * * @since 3.4.6 * @experimental * @category scheduling */ (f: () => number): (self: MicroSchedule) => MicroSchedule; /** * Returns a new `MicroSchedule` with an added calculated delay to each delay * returned by this schedule. * * @since 3.4.6 * @experimental * @category scheduling */ (self: MicroSchedule, f: () => number): MicroSchedule; }; /** * Transform a `MicroSchedule` to one that will have a delay that will never exceed * the specified maximum. * * @since 3.4.6 * @experimental * @category scheduling */ export declare const scheduleWithMaxDelay: { /** * Transform a `MicroSchedule` to one that will have a delay that will never exceed * the specified maximum. * * @since 3.4.6 * @experimental * @category scheduling */ (max: number): (self: MicroSchedule) => MicroSchedule; /** * Transform a `MicroSchedule` to one that will have a delay that will never exceed * the specified maximum. * * @since 3.4.6 * @experimental * @category scheduling */ (self: MicroSchedule, max: number): MicroSchedule; }; /** * Transform a `MicroSchedule` to one that will stop repeating after the specified * amount of time. * * @since 3.4.6 * @experimental * @category scheduling */ export declare const scheduleWithMaxElapsed: { /** * Transform a `MicroSchedule` to one that will stop repeating after the specified * amount of time. * * @since 3.4.6 * @experimental * @category scheduling */ (max: number): (self: MicroSchedule) => MicroSchedule; /** * Transform a `MicroSchedule` to one that will stop repeating after the specified * amount of time. * * @since 3.4.6 * @experimental * @category scheduling */ (self: MicroSchedule, max: number): MicroSchedule; }; /** * Combines two `MicroSchedule`s, by recurring if either schedule wants to * recur, using the minimum of the two durations between recurrences. * * @since 3.4.6 * @experimental * @category scheduling */ export declare const scheduleUnion: { /** * Combines two `MicroSchedule`s, by recurring if either schedule wants to * recur, using the minimum of the two durations between recurrences. * * @since 3.4.6 * @experimental * @category scheduling */ (that: MicroSchedule): (self: MicroSchedule) => MicroSchedule; /** * Combines two `MicroSchedule`s, by recurring if either schedule wants to * recur, using the minimum of the two durations between recurrences. * * @since 3.4.6 * @experimental * @category scheduling */ (self: MicroSchedule, that: MicroSchedule): MicroSchedule; }; /** * Combines two `MicroSchedule`s, by recurring only if both schedules want to * recur, using the maximum of the two durations between recurrences. * * @since 3.4.6 * @experimental * @category scheduling */ export declare const scheduleIntersect: { /** * Combines two `MicroSchedule`s, by recurring only if both schedules want to * recur, using the maximum of the two durations between recurrences. * * @since 3.4.6 * @experimental * @category scheduling */ (that: MicroSchedule): (self: MicroSchedule) => MicroSchedule; /** * Combines two `MicroSchedule`s, by recurring only if both schedules want to * recur, using the maximum of the two durations between recurrences. * * @since 3.4.6 * @experimental * @category scheduling */ (self: MicroSchedule, that: MicroSchedule): MicroSchedule; }; /** * Catch the full `MicroCause` object of the given `Micro` effect, allowing you to * recover from any kind of cause. * * @since 3.4.6 * @experimental * @category error handling */ export declare const catchAllCause: { /** * Catch the full `MicroCause` object of the given `Micro` effect, allowing you to * recover from any kind of cause. * * @since 3.4.6 * @experimental * @category error handling */ (f: (cause: NoInfer>) => Micro): (self: Micro) => Micro; /** * Catch the full `MicroCause` object of the given `Micro` effect, allowing you to * recover from any kind of cause. * * @since 3.4.6 * @experimental * @category error handling */ (self: Micro, f: (cause: NoInfer>) => Micro): Micro; }; /** * Selectively catch a `MicroCause` object of the given `Micro` effect, * using the provided predicate to determine if the failure should be caught. * * @since 3.4.6 * @experimental * @category error handling */ export declare const catchCauseIf: { /** * Selectively catch a `MicroCause` object of the given `Micro` effect, * using the provided predicate to determine if the failure should be caught. * * @since 3.4.6 * @experimental * @category error handling */ >(refinement: Refinement, EB>, f: (cause: EB) => Micro): (self: Micro) => Micro> | E2, R | R2>; /** * Selectively catch a `MicroCause` object of the given `Micro` effect, * using the provided predicate to determine if the failure should be caught. * * @since 3.4.6 * @experimental * @category error handling */ (predicate: Predicate>>, f: (cause: NoInfer>) => Micro): (self: Micro) => Micro; /** * Selectively catch a `MicroCause` object of the given `Micro` effect, * using the provided predicate to determine if the failure should be caught. * * @since 3.4.6 * @experimental * @category error handling */ >(self: Micro, refinement: Refinement, EB>, f: (cause: EB) => Micro): Micro> | E2, R | R2>; /** * Selectively catch a `MicroCause` object of the given `Micro` effect, * using the provided predicate to determine if the failure should be caught. * * @since 3.4.6 * @experimental * @category error handling */ (self: Micro, predicate: Predicate>>, f: (cause: NoInfer>) => Micro): Micro; }; /** * Catch the error of the given `Micro` effect, allowing you to recover from it. * * It only catches expected errors. * * @since 3.4.6 * @experimental * @category error handling */ export declare const catchAll: { /** * Catch the error of the given `Micro` effect, allowing you to recover from it. * * It only catches expected errors. * * @since 3.4.6 * @experimental * @category error handling */ (f: (e: NoInfer) => Micro): (self: Micro) => Micro; /** * Catch the error of the given `Micro` effect, allowing you to recover from it. * * It only catches expected errors. * * @since 3.4.6 * @experimental * @category error handling */ (self: Micro, f: (e: NoInfer) => Micro): Micro; }; /** * Catch any unexpected errors of the given `Micro` effect, allowing you to recover from them. * * @since 3.4.6 * @experimental * @category error handling */ export declare const catchAllDefect: { /** * Catch any unexpected errors of the given `Micro` effect, allowing you to recover from them. * * @since 3.4.6 * @experimental * @category error handling */ (f: (defect: unknown) => Micro): (self: Micro) => Micro; /** * Catch any unexpected errors of the given `Micro` effect, allowing you to recover from them. * * @since 3.4.6 * @experimental * @category error handling */ (self: Micro, f: (defect: unknown) => Micro): Micro; }; /** * Perform a side effect using the full `MicroCause` object of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ export declare const tapErrorCause: { /** * Perform a side effect using the full `MicroCause` object of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ (f: (cause: NoInfer>) => Micro): (self: Micro) => Micro; /** * Perform a side effect using the full `MicroCause` object of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ (self: Micro, f: (cause: NoInfer>) => Micro): Micro; }; /** * Perform a side effect using if a `MicroCause` object matches the specified * predicate. * * @since 3.4.0 * @experimental * @category error handling */ export declare const tapErrorCauseIf: { /** * Perform a side effect using if a `MicroCause` object matches the specified * predicate. * * @since 3.4.0 * @experimental * @category error handling */ >(refinement: Refinement, EB>, f: (a: EB) => Micro): (self: Micro) => Micro; /** * Perform a side effect using if a `MicroCause` object matches the specified * predicate. * * @since 3.4.0 * @experimental * @category error handling */ (predicate: (cause: NoInfer>) => boolean, f: (a: NoInfer>) => Micro): (self: Micro) => Micro; /** * Perform a side effect using if a `MicroCause` object matches the specified * predicate. * * @since 3.4.0 * @experimental * @category error handling */ >(self: Micro, refinement: Refinement, EB>, f: (a: EB) => Micro): Micro; /** * Perform a side effect using if a `MicroCause` object matches the specified * predicate. * * @since 3.4.0 * @experimental * @category error handling */ (self: Micro, predicate: (cause: NoInfer>) => boolean, f: (a: NoInfer>) => Micro): Micro; }; /** * Perform a side effect from expected errors of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ export declare const tapError: { /** * Perform a side effect from expected errors of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ (f: (e: NoInfer) => Micro): (self: Micro) => Micro; /** * Perform a side effect from expected errors of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ (self: Micro, f: (e: NoInfer) => Micro): Micro; }; /** * Perform a side effect from unexpected errors of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ export declare const tapDefect: { /** * Perform a side effect from unexpected errors of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ (f: (defect: unknown) => Micro): (self: Micro) => Micro; /** * Perform a side effect from unexpected errors of the given `Micro`. * * @since 3.4.6 * @experimental * @category error handling */ (self: Micro, f: (defect: unknown) => Micro): Micro; }; /** * Catch any expected errors that match the specified predicate. * * @since 3.4.0 * @experimental * @category error handling */ export declare const catchIf: { /** * Catch any expected errors that match the specified predicate. * * @since 3.4.0 * @experimental * @category error handling */ (refinement: Refinement, EB>, f: (e: EB) => Micro): (self: Micro) => Micro, R2 | R>; /** * Catch any expected errors that match the specified predicate. * * @since 3.4.0 * @experimental * @category error handling */ (predicate: Predicate>, f: (e: NoInfer) => Micro): (self: Micro) => Micro; /** * Catch any expected errors that match the specified predicate. * * @since 3.4.0 * @experimental * @category error handling */ (self: Micro, refinement: Refinement, f: (e: EB) => Micro): Micro, R | R2>; /** * Catch any expected errors that match the specified predicate. * * @since 3.4.0 * @experimental * @category error handling */ (self: Micro, predicate: Predicate, f: (e: E) => Micro): Micro; }; /** * Recovers from the specified tagged error. * * @since 3.4.0 * @experimental * @category error handling */ export declare const catchTag: { /** * Recovers from the specified tagged error. * * @since 3.4.0 * @experimental * @category error handling */ (k: K, f: (e: Extract) => Micro): (self: Micro) => Micro, R1 | R>; /** * Recovers from the specified tagged error. * * @since 3.4.0 * @experimental * @category error handling */ (self: Micro, k: K, f: (e: Extract) => Micro): Micro, R | R1>; }; /** * Transform the full `MicroCause` object of the given `Micro` effect. * * @since 3.4.6 * @experimental * @category error handling */ export declare const mapErrorCause: { /** * Transform the full `MicroCause` object of the given `Micro` effect. * * @since 3.4.6 * @experimental * @category error handling */ (f: (e: MicroCause) => MicroCause): (self: Micro) => Micro; /** * Transform the full `MicroCause` object of the given `Micro` effect. * * @since 3.4.6 * @experimental * @category error handling */ (self: Micro, f: (e: MicroCause) => MicroCause): Micro; }; /** * Transform any expected errors of the given `Micro` effect. * * @since 3.4.0 * @experimental * @category error handling */ export declare const mapError: { /** * Transform any expected errors of the given `Micro` effect. * * @since 3.4.0 * @experimental * @category error handling */ (f: (e: E) => E2): (self: Micro) => Micro; /** * Transform any expected errors of the given `Micro` effect. * * @since 3.4.0 * @experimental * @category error handling */ (self: Micro, f: (e: E) => E2): Micro; }; /** * Elevate any expected errors of the given `Micro` effect to unexpected errors, * resulting in an error type of `never`. * * @since 3.4.0 * @experimental * @category error handling */ export declare const orDie: (self: Micro) => Micro; /** * Recover from all errors by succeeding with the given value. * * @since 3.4.0 * @experimental * @category error handling */ export declare const orElseSucceed: { /** * Recover from all errors by succeeding with the given value. * * @since 3.4.0 * @experimental * @category error handling */ (f: LazyArg): (self: Micro) => Micro; /** * Recover from all errors by succeeding with the given value. * * @since 3.4.0 * @experimental * @category error handling */ (self: Micro, f: LazyArg): Micro; }; /** * Ignore any expected errors of the given `Micro` effect, returning `void`. * * @since 3.4.0 * @experimental * @category error handling */ export declare const ignore: (self: Micro) => Micro; /** * Ignore any expected errors of the given `Micro` effect, returning `void`. * * @since 3.4.0 * @experimental * @category error handling */ export declare const ignoreLogged: (self: Micro) => Micro; /** * Replace the success value of the given `Micro` effect with an `Option`, * wrapping the success value in `Some` and returning `None` if the effect fails * with an expected error. * * @since 3.4.0 * @experimental * @category error handling */ export declare const option: (self: Micro) => Micro, never, R>; /** * Replace the success value of the given `Micro` effect with an `Either`, * wrapping the success value in `Right` and wrapping any expected errors with * a `Left`. * * @since 3.4.0 * @experimental * @category error handling */ export declare const either: (self: Micro) => Micro, never, R>; /** * Retry the given `Micro` effect using the provided options. * * @since 3.4.0 * @experimental * @category error handling */ export declare const retry: { /** * Retry the given `Micro` effect using the provided options. * * @since 3.4.0 * @experimental * @category error handling */ (options?: { while?: Predicate | undefined; times?: number | undefined; schedule?: MicroSchedule | undefined; } | undefined): (self: Micro) => Micro; /** * Retry the given `Micro` effect using the provided options. * * @since 3.4.0 * @experimental * @category error handling */ (self: Micro, options?: { while?: Predicate | undefined; times?: number | undefined; schedule?: MicroSchedule | undefined; } | undefined): Micro; }; /** * Add a stack trace to any failures that occur in the effect. The trace will be * added to the `traces` field of the `MicroCause` object. * * @since 3.4.0 * @experimental * @category error handling */ export declare const withTrace: { /** * Add a stack trace to any failures that occur in the effect. The trace will be * added to the `traces` field of the `MicroCause` object. * * @since 3.4.0 * @experimental * @category error handling */ (name: string): (self: Micro) => Micro; /** * Add a stack trace to any failures that occur in the effect. The trace will be * added to the `traces` field of the `MicroCause` object. * * @since 3.4.0 * @experimental * @category error handling */ (self: Micro, name: string): Micro; }; /** * @since 3.4.6 * @experimental * @category pattern matching */ export declare const matchCauseEffect: { /** * @since 3.4.6 * @experimental * @category pattern matching */ (options: { readonly onFailure: (cause: MicroCause) => Micro; readonly onSuccess: (a: A) => Micro; }): (self: Micro) => Micro; /** * @since 3.4.6 * @experimental * @category pattern matching */ (self: Micro, options: { readonly onFailure: (cause: MicroCause) => Micro; readonly onSuccess: (a: A) => Micro; }): Micro; }; /** * @since 3.4.6 * @experimental * @category pattern matching */ export declare const matchCause: { /** * @since 3.4.6 * @experimental * @category pattern matching */ (options: { readonly onFailure: (cause: MicroCause) => A2; readonly onSuccess: (a: A) => A3; }): (self: Micro) => Micro; /** * @since 3.4.6 * @experimental * @category pattern matching */ (self: Micro, options: { readonly onFailure: (cause: MicroCause) => A2; readonly onSuccess: (a: A) => A3; }): Micro; }; /** * @since 3.4.6 * @experimental * @category pattern matching */ export declare const matchEffect: { /** * @since 3.4.6 * @experimental * @category pattern matching */ (options: { readonly onFailure: (e: E) => Micro; readonly onSuccess: (a: A) => Micro; }): (self: Micro) => Micro; /** * @since 3.4.6 * @experimental * @category pattern matching */ (self: Micro, options: { readonly onFailure: (e: E) => Micro; readonly onSuccess: (a: A) => Micro; }): Micro; }; /** * @since 3.4.0 * @experimental * @category pattern matching */ export declare const match: { /** * @since 3.4.0 * @experimental * @category pattern matching */ (options: { readonly onFailure: (error: E) => A2; readonly onSuccess: (value: A) => A3; }): (self: Micro) => Micro; /** * @since 3.4.0 * @experimental * @category pattern matching */ (self: Micro, options: { readonly onFailure: (error: E) => A2; readonly onSuccess: (value: A) => A3; }): Micro; }; /** * Create a `Micro` effect that will sleep for the specified duration. * * @since 3.4.0 * @experimental * @category delays & timeouts */ export declare const sleep: (millis: number) => Micro; /** * Returns an effect that will delay the execution of this effect by the * specified duration. * * @since 3.4.0 * @experimental * @category delays & timeouts */ export declare const delay: { /** * Returns an effect that will delay the execution of this effect by the * specified duration. * * @since 3.4.0 * @experimental * @category delays & timeouts */ (millis: number): (self: Micro) => Micro; /** * Returns an effect that will delay the execution of this effect by the * specified duration. * * @since 3.4.0 * @experimental * @category delays & timeouts */ (self: Micro, millis: number): Micro; }; /** * Returns an effect that will timeout this effect, that will execute the * fallback effect if the timeout elapses before the effect has produced a value. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ export declare const timeoutOrElse: { /** * Returns an effect that will timeout this effect, that will execute the * fallback effect if the timeout elapses before the effect has produced a value. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ (options: { readonly duration: number; readonly onTimeout: LazyArg>; }): (self: Micro) => Micro; /** * Returns an effect that will timeout this effect, that will execute the * fallback effect if the timeout elapses before the effect has produced a value. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ (self: Micro, options: { readonly duration: number; readonly onTimeout: LazyArg>; }): Micro; }; /** * Returns an effect that will timeout this effect, that will fail with a * `TimeoutException` if the timeout elapses before the effect has produced a * value. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ export declare const timeout: { /** * Returns an effect that will timeout this effect, that will fail with a * `TimeoutException` if the timeout elapses before the effect has produced a * value. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ (millis: number): (self: Micro) => Micro; /** * Returns an effect that will timeout this effect, that will fail with a * `TimeoutException` if the timeout elapses before the effect has produced a * value. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ (self: Micro, millis: number): Micro; }; /** * Returns an effect that will timeout this effect, succeeding with a `None` * if the timeout elapses before the effect has produced a value; and `Some` of * the produced value otherwise. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ export declare const timeoutOption: { /** * Returns an effect that will timeout this effect, succeeding with a `None` * if the timeout elapses before the effect has produced a value; and `Some` of * the produced value otherwise. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ (millis: number): (self: Micro) => Micro, E, R>; /** * Returns an effect that will timeout this effect, succeeding with a `None` * if the timeout elapses before the effect has produced a value; and `Some` of * the produced value otherwise. * * If the timeout elapses, the running effect will be safely interrupted. * * @since 3.4.0 * @experimental * @category delays & timeouts */ (self: Micro, millis: number): Micro, E, R>; }; /** * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const MicroScopeTypeId: unique symbol; /** * @since 3.4.0 * @experimental * @category resources & finalization */ export type MicroScopeTypeId = typeof MicroScopeTypeId; /** * @since 3.4.0 * @experimental * @category resources & finalization */ export interface MicroScope { readonly [MicroScopeTypeId]: MicroScopeTypeId; readonly addFinalizer: (finalizer: (exit: MicroExit) => Micro) => Micro; readonly fork: Micro; } /** * @since 3.4.0 * @experimental * @category resources & finalization */ export declare namespace MicroScope { /** * @since 3.4.0 * @experimental * @category resources & finalization */ interface Closeable extends MicroScope { readonly close: (exit: MicroExit) => Micro; } } /** * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const MicroScope: Context.Tag; /** * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const scopeMake: Micro; /** * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const scopeUnsafeMake: () => MicroScope.Closeable; /** * Access the current `MicroScope`. * * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const scope: Micro; /** * Provide a `MicroScope` to an effect. * * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const provideScope: { /** * Provide a `MicroScope` to an effect. * * @since 3.4.0 * @experimental * @category resources & finalization */ (scope: MicroScope): (self: Micro) => Micro>; /** * Provide a `MicroScope` to an effect. * * @since 3.4.0 * @experimental * @category resources & finalization */ (self: Micro, scope: MicroScope): Micro>; }; /** * Provide a `MicroScope` to the given effect, closing it after the effect has * finished executing. * * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const scoped: (self: Micro) => Micro>; /** * Create a resource with a cleanup `Micro` effect, ensuring the cleanup is * executed when the `MicroScope` is closed. * * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const acquireRelease: (acquire: Micro, release: (a: A, exit: MicroExit) => Micro) => Micro; /** * Add a finalizer to the current `MicroScope`. * * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const addFinalizer: (finalizer: (exit: MicroExit) => Micro) => Micro; /** * When the `Micro` effect is completed, run the given finalizer effect with the * `MicroExit` of the executed effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ export declare const onExit: { /** * When the `Micro` effect is completed, run the given finalizer effect with the * `MicroExit` of the executed effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ (f: (exit: MicroExit) => Micro): (self: Micro) => Micro; /** * When the `Micro` effect is completed, run the given finalizer effect with the * `MicroExit` of the executed effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ (self: Micro, f: (exit: MicroExit) => Micro): Micro; }; /** * Regardless of the result of the this `Micro` effect, run the finalizer effect. * * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const ensuring: { /** * Regardless of the result of the this `Micro` effect, run the finalizer effect. * * @since 3.4.0 * @experimental * @category resources & finalization */ (finalizer: Micro): (self: Micro) => Micro; /** * Regardless of the result of the this `Micro` effect, run the finalizer effect. * * @since 3.4.0 * @experimental * @category resources & finalization */ (self: Micro, finalizer: Micro): Micro; }; /** * When the `Micro` effect is completed, run the given finalizer effect if it * matches the specified predicate. * * @since 3.4.6 * @experimental * @category resources & finalization */ export declare const onExitIf: { /** * When the `Micro` effect is completed, run the given finalizer effect if it * matches the specified predicate. * * @since 3.4.6 * @experimental * @category resources & finalization */ >(refinement: Refinement, B>, f: (exit: B) => Micro): (self: Micro) => Micro; /** * When the `Micro` effect is completed, run the given finalizer effect if it * matches the specified predicate. * * @since 3.4.6 * @experimental * @category resources & finalization */ (predicate: Predicate, NoInfer>>, f: (exit: MicroExit, NoInfer>) => Micro): (self: Micro) => Micro; /** * When the `Micro` effect is completed, run the given finalizer effect if it * matches the specified predicate. * * @since 3.4.6 * @experimental * @category resources & finalization */ >(self: Micro, refinement: Refinement, B>, f: (exit: B) => Micro): Micro; /** * When the `Micro` effect is completed, run the given finalizer effect if it * matches the specified predicate. * * @since 3.4.6 * @experimental * @category resources & finalization */ (self: Micro, predicate: Predicate, NoInfer>>, f: (exit: MicroExit, NoInfer>) => Micro): Micro; }; /** * When the `Micro` effect fails, run the given finalizer effect with the * `MicroCause` of the executed effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ export declare const onError: { /** * When the `Micro` effect fails, run the given finalizer effect with the * `MicroCause` of the executed effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ (f: (cause: MicroCause>) => Micro): (self: Micro) => Micro; /** * When the `Micro` effect fails, run the given finalizer effect with the * `MicroCause` of the executed effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ (self: Micro, f: (cause: MicroCause>) => Micro): Micro; }; /** * If this `Micro` effect is aborted, run the finalizer effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ export declare const onInterrupt: { /** * If this `Micro` effect is aborted, run the finalizer effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ (finalizer: Micro): (self: Micro) => Micro; /** * If this `Micro` effect is aborted, run the finalizer effect. * * @since 3.4.6 * @experimental * @category resources & finalization */ (self: Micro, finalizer: Micro): Micro; }; /** * Acquire a resource, use it, and then release the resource when the `use` * effect has completed. * * @since 3.4.0 * @experimental * @category resources & finalization */ export declare const acquireUseRelease: (acquire: Micro, use: (a: Resource) => Micro, release: (a: Resource, exit: MicroExit) => Micro) => Micro; /** * Abort the current `Micro` effect. * * @since 3.4.6 * @experimental * @category interruption */ export declare const interrupt: Micro; /** * Flag the effect as uninterruptible, which means that when the effect is * interrupted, it will be allowed to continue running until completion. * * @since 3.4.0 * @experimental * @category flags */ export declare const uninterruptible: (self: Micro) => Micro; /** * Flag the effect as interruptible, which means that when the effect is * interrupted, it will be interrupted immediately. * * @since 3.4.0 * @experimental * @category flags */ export declare const interruptible: (self: Micro) => Micro; /** * Wrap the given `Micro` effect in an uninterruptible region, preventing the * effect from being aborted. * * You can use the `restore` function to restore a `Micro` effect to the * interruptibility state before the `uninterruptibleMask` was applied. * * @example * ```ts * import * as Micro from "effect/Micro" * * Micro.uninterruptibleMask((restore) => * Micro.sleep(1000).pipe( // uninterruptible * Micro.andThen(restore(Micro.sleep(1000))) // interruptible * ) * ) * ``` * * @since 3.4.0 * @experimental * @category interruption */ export declare const uninterruptibleMask: (f: (restore: (effect: Micro) => Micro) => Micro) => Micro; /** * @since 3.4.0 * @experimental */ export declare namespace All { /** * @since 3.4.0 * @experimental */ type MicroAny = Micro; /** * @since 3.4.0 * @experimental */ type ReturnIterable, Discard extends boolean> = [T] extends [ Iterable> ] ? Micro, E, R> : never; /** * @since 3.4.0 * @experimental */ type ReturnTuple, Discard extends boolean> = Micro ? _A : never; }, T[number] extends never ? never : T[number] extends Micro ? _E : never, T[number] extends never ? never : T[number] extends Micro ? _R : never> extends infer X ? X : never; /** * @since 3.4.0 * @experimental */ type ReturnObject = [T] extends [{ [K: string]: MicroAny; }] ? Micro] ? _A : never; }, keyof T extends never ? never : T[keyof T] extends Micro ? _E : never, keyof T extends never ? never : T[keyof T] extends Micro ? _R : never> : never; /** * @since 3.4.0 * @experimental */ type IsDiscard = [Extract] extends [never] ? false : true; /** * @since 3.4.0 * @experimental */ type Return | Record, O extends NoExcessProperties<{ readonly concurrency?: Concurrency | undefined; readonly discard?: boolean | undefined; }, O>> = [Arg] extends [ReadonlyArray] ? ReturnTuple> : [Arg] extends [Iterable] ? ReturnIterable> : [Arg] extends [Record] ? ReturnObject> : never; } /** * Runs all the provided effects in sequence respecting the structure provided in input. * * Supports multiple arguments, a single argument tuple / array or record / struct. * * @since 3.4.0 * @experimental * @category collecting & elements */ export declare const all: > | Record>, O extends NoExcessProperties<{ readonly concurrency?: Concurrency | undefined; readonly discard?: boolean | undefined; }, O>>(arg: Arg, options?: O) => All.Return; /** * @since 3.11.0 * @experimental * @category collecting & elements */ export declare const whileLoop: (options: { readonly while: LazyArg; readonly body: LazyArg>; readonly step: (a: A) => void; }) => Micro; /** * For each element of the provided iterable, run the effect and collect the * results. * * If the `discard` option is set to `true`, the results will be discarded and * the effect will return `void`. * * The `concurrency` option can be set to control how many effects are run * concurrently. By default, the effects are run sequentially. * * @since 3.4.0 * @experimental * @category collecting & elements */ export declare const forEach: { /** * For each element of the provided iterable, run the effect and collect the * results. * * If the `discard` option is set to `true`, the results will be discarded and * the effect will return `void`. * * The `concurrency` option can be set to control how many effects are run * concurrently. By default, the effects are run sequentially. * * @since 3.4.0 * @experimental * @category collecting & elements */ (iterable: Iterable, f: (a: A, index: number) => Micro, options?: { readonly concurrency?: Concurrency | undefined; readonly discard?: false | undefined; }): Micro, E, R>; /** * For each element of the provided iterable, run the effect and collect the * results. * * If the `discard` option is set to `true`, the results will be discarded and * the effect will return `void`. * * The `concurrency` option can be set to control how many effects are run * concurrently. By default, the effects are run sequentially. * * @since 3.4.0 * @experimental * @category collecting & elements */ (iterable: Iterable, f: (a: A, index: number) => Micro, options: { readonly concurrency?: Concurrency | undefined; readonly discard: true; }): Micro; }; /** * Effectfully filter the elements of the provided iterable. * * Use the `concurrency` option to control how many elements are processed * concurrently. * * @since 3.4.0 * @experimental * @category collecting & elements */ export declare const filter: (iterable: Iterable, f: (a: NoInfer) => Micro, options?: { readonly concurrency?: Concurrency | undefined; readonly negate?: boolean | undefined; }) => Micro, E, R>; /** * Effectfully filter the elements of the provided iterable. * * Use the `concurrency` option to control how many elements are processed * concurrently. * * @since 3.4.0 * @experimental * @category collecting & elements */ export declare const filterMap: (iterable: Iterable, f: (a: NoInfer) => Micro, E, R>, options?: { readonly concurrency?: Concurrency | undefined; }) => Micro, E, R>; /** * Start a do notation block. * * @since 3.4.0 * @experimental * @category do notation */ export declare const Do: Micro<{}>; /** * Bind the success value of this `Micro` effect to the provided name. * * @since 3.4.0 * @experimental * @category do notation */ export declare const bindTo: { /** * Bind the success value of this `Micro` effect to the provided name. * * @since 3.4.0 * @experimental * @category do notation */ (name: N): (self: Micro) => Micro<{ [K in N]: A; }, E, R>; /** * Bind the success value of this `Micro` effect to the provided name. * * @since 3.4.0 * @experimental * @category do notation */ (self: Micro, name: N): Micro<{ [K in N]: A; }, E, R>; }; /** * Bind the success value of this `Micro` effect to the provided name. * * @since 3.4.0 * @experimental * @category do notation */ export declare const bind: { /** * Bind the success value of this `Micro` effect to the provided name. * * @since 3.4.0 * @experimental * @category do notation */ , B, E2, R2>(name: N, f: (a: NoInfer) => Micro): (self: Micro) => Micro & { [K in N]: B; }>, E | E2, R | R2>; /** * Bind the success value of this `Micro` effect to the provided name. * * @since 3.4.0 * @experimental * @category do notation */ , E, R, B, E2, R2, N extends string>(self: Micro, name: N, f: (a: NoInfer) => Micro): Micro & { [K in N]: B; }>, E | E2, R | R2>; }; declare const let_: { , B>(name: N, f: (a: NoInfer) => B): (self: Micro) => Micro & { [K in N]: B; }>, E, R>; , E, R, B, N extends string>(self: Micro, name: N, f: (a: NoInfer) => B): Micro & { [K in N]: B; }>, E, R>; }; export { /** * Bind the result of a synchronous computation to the given name. * * @since 3.4.0 * @experimental * @category do notation */ let_ as let }; /** * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or * aborted. * * When the parent `Micro` finishes, this `Micro` will be aborted. * * @since 3.4.0 * @experimental * @category fiber & forking */ export declare const fork: (self: Micro) => Micro, never, R>; /** * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or * aborted. * * It will not be aborted when the parent `Micro` finishes. * * @since 3.4.0 * @experimental * @category fiber & forking */ export declare const forkDaemon: (self: Micro) => Micro, never, R>; /** * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or * aborted. * * The lifetime of the handle will be attached to the provided `MicroScope`. * * @since 3.4.0 * @experimental * @category fiber & forking */ export declare const forkIn: { /** * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or * aborted. * * The lifetime of the handle will be attached to the provided `MicroScope`. * * @since 3.4.0 * @experimental * @category fiber & forking */ (scope: MicroScope): (self: Micro) => Micro, never, R>; /** * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or * aborted. * * The lifetime of the handle will be attached to the provided `MicroScope`. * * @since 3.4.0 * @experimental * @category fiber & forking */ (self: Micro, scope: MicroScope): Micro, never, R>; }; /** * Run the `Micro` effect in a new `MicroFiber` that can be awaited, joined, or * aborted. * * The lifetime of the handle will be attached to the current `MicroScope`. * * @since 3.4.0 * @experimental * @category fiber & forking */ export declare const forkScoped: (self: Micro) => Micro, never, R | MicroScope>; /** * Execute the `Micro` effect and return a `MicroFiber` that can be awaited, joined, * or aborted. * * You can listen for the result by adding an observer using the handle's * `addObserver` method. * * @example * ```ts * import * as Micro from "effect/Micro" * * const handle = Micro.succeed(42).pipe( * Micro.delay(1000), * Micro.runFork * ) * * handle.addObserver((exit) => { * console.log(exit) * }) * ``` * * @since 3.4.0 * @experimental * @category execution */ export declare const runFork: (effect: Micro, options?: { readonly signal?: AbortSignal | undefined; readonly scheduler?: MicroScheduler | undefined; } | undefined) => MicroFiberImpl; /** * Execute the `Micro` effect and return a `Promise` that resolves with the * `MicroExit` of the computation. * * @since 3.4.6 * @experimental * @category execution */ export declare const runPromiseExit: (effect: Micro, options?: { readonly signal?: AbortSignal | undefined; readonly scheduler?: MicroScheduler | undefined; } | undefined) => Promise>; /** * Execute the `Micro` effect and return a `Promise` that resolves with the * successful value of the computation. * * @since 3.4.0 * @experimental * @category execution */ export declare const runPromise: (effect: Micro, options?: { readonly signal?: AbortSignal | undefined; readonly scheduler?: MicroScheduler | undefined; } | undefined) => Promise; /** * Attempt to execute the `Micro` effect synchronously and return the `MicroExit`. * * If any asynchronous effects are encountered, the function will return a * `CauseDie` containing the `MicroFiber`. * * @since 3.4.6 * @experimental * @category execution */ export declare const runSyncExit: (effect: Micro) => MicroExit; /** * Attempt to execute the `Micro` effect synchronously and return the success * value. * * @since 3.4.0 * @experimental * @category execution */ export declare const runSync: (effect: Micro) => A; /** * @since 3.4.0 * @experimental * @category errors */ export interface YieldableError extends Pipeable, Inspectable, Readonly { readonly [Effectable.EffectTypeId]: Effect.VarianceStruct; readonly [Effectable.StreamTypeId]: Stream.VarianceStruct; readonly [Effectable.SinkTypeId]: Sink.VarianceStruct; readonly [Effectable.ChannelTypeId]: Channel.VarianceStruct; readonly [TypeId]: Micro.Variance; [Symbol.iterator](): MicroIterator>; } /** * @since 3.4.0 * @experimental * @category errors */ export declare const Error: new = {}>(args: Equals extends true ? void : { readonly [P in keyof A]: A[P]; }) => YieldableError & Readonly; /** * @since 3.4.0 * @experimental * @category errors */ export declare const TaggedError: (tag: Tag) => new = {}>(args: Equals extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & { readonly _tag: Tag; } & Readonly; declare const NoSuchElementException_base: new = {}>(args: Equals extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & { readonly _tag: "NoSuchElementException"; } & Readonly; /** * Represents a checked exception which occurs when an expected element was * unable to be found. * * @since 3.4.4 * @experimental * @category errors */ export declare class NoSuchElementException extends NoSuchElementException_base<{ message?: string | undefined; }> { } declare const TimeoutException_base: new = {}>(args: Equals extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => YieldableError & { readonly _tag: "TimeoutException"; } & Readonly; /** * Represents a checked exception which occurs when a timeout occurs. * * @since 3.4.4 * @experimental * @category errors */ export declare class TimeoutException extends TimeoutException_base { } //# sourceMappingURL=Micro.d.ts.map