import * as Tp from "../Collections/Immutable/Tuple/index.js"; import * as E from "../Either/index.js"; import * as T from "./excl-effect.js"; export declare const TypeId: unique symbol; export declare type TypeId = typeof TypeId; export interface XFiberRef { /** * Folds over the error and value types of the `FiberRef`. This is a highly * polymorphic method that is capable of arbitrarily transforming the error * and value types of the `FiberRef`. For most use cases one of the more * specific combinators implemented in terms of `fold` will be more ergonomic * but this method is extremely useful for implementing new combinators. */ readonly fold: (ea: (_: EA) => EC, eb: (_: EB) => ED, ca: (_: C) => E.Either, bd: (_: B) => E.Either) => XFiberRef; /** * Folds over the error and value types of the `FiberRef`, allowing access * to the state in transforming the `set` value. This is a more powerful * version of `fold` but requires unifying the error types. */ readonly foldAll: (ea: (_: EA) => EC, eb: (_: EB) => ED, ec: (_: EB) => EC, ca: (_: C) => (_: B) => E.Either, bd: (_: B) => E.Either) => XFiberRef; /** * Reads the value associated with the current fiber. Returns initial value if * no value was `set` or inherited from parent. */ readonly get: T.IO; /** * Returns an `IO` that runs with `value` bound to the current fiber. * * Guarantees that fiber data is properly restored via `bracket`. */ readonly locally: (value: A, use: T.Effect) => T.Effect; /** * Sets the value associated with the current fiber. */ readonly set: (value: A) => T.IO; } export declare class Runtime implements XFiberRef { readonly initial: A; readonly fork: (_: A) => A; readonly join: (a: A, a1: A) => A; readonly _tag = "Runtime"; readonly _typeId: TypeId; readonly _EA: () => never; readonly _EB: () => never; readonly _A: (_: A) => void; readonly _B: () => A; constructor(initial: A, fork?: (_: A) => A, join?: (a: A, a1: A) => A); fold(_ea: (_: never) => EC, _eb: (_: never) => ED, ca: (_: C) => E.Either, bd: (_: A) => E.Either): XFiberRef; foldAll(_ea: (_: never) => EC, _eb: (_: never) => ED, _ec: (_: never) => EC, ca: (_: C) => (_: A) => E.Either, bd: (_: A) => E.Either): XFiberRef; modify(f: (a: A) => Tp.Tuple<[B, A]>): T.UIO; get get(): T.UIO; locally(a: A, use: T.Effect): T.Effect; set(value: A): T.UIO; } export declare class Derived implements XFiberRef { readonly use: (f: (value: Runtime, getEither: (s: S) => E.Either, setEither: (a: A) => E.Either) => X) => X; readonly _tag = "Derived"; readonly _typeId: TypeId; readonly _EA: () => EA; readonly _EB: () => EB; readonly _A: (_: A) => void; readonly _B: () => B; constructor(use: (f: (value: Runtime, getEither: (s: S) => E.Either, setEither: (a: A) => E.Either) => X) => X); fold(ea: (_: EA) => EC, eb: (_: EB) => ED, ca: (_: C) => E.Either, bd: (_: B) => E.Either): XFiberRef; foldAll(ea: (_: EA) => EC, eb: (_: EB) => ED, ec: (_: EB) => EC, ca: (_: C) => (_: B) => E.Either, _bd: (_: B) => E.Either): XFiberRef; get get(): T.IO; locally(a: A, use: T.Effect): T.Effect; set(a: A): T.IO; } export declare class DerivedAll implements XFiberRef { readonly use: (f: (value: Runtime, getEither: (s: S) => E.Either, setEither: (a: A) => (s: S) => E.Either) => X) => X; readonly _tag = "DerivedAll"; readonly _typeId: TypeId; readonly _EA: () => EA; readonly _EB: () => EB; readonly _A: (_: A) => void; readonly _B: () => B; constructor(use: (f: (value: Runtime, getEither: (s: S) => E.Either, setEither: (a: A) => (s: S) => E.Either) => X) => X); fold(ea: (_: EA) => EC, eb: (_: EB) => ED, ca: (_: C) => E.Either, bd: (_: B) => E.Either): XFiberRef; foldAll(ea: (_: EA) => EC, eb: (_: EB) => ED, ec: (_: EB) => EC, ca: (_: C) => (_: B) => E.Either, bd: (_: B) => E.Either): XFiberRef; get get(): T.IO; locally(a: A, use: T.Effect): T.Effect; set(a: A): T.IO; } export interface FiberRef extends XFiberRef { } /** * @ets_optimize identity */ export declare function concrete(_: XFiberRef): Runtime | Derived | DerivedAll; //# sourceMappingURL=fiberRef.d.ts.map