import * as E from "../../Either"; import type { AtomicReference } from "../../support"; import * as T from "../Task/_core"; import type { EIO, IO } from "../Task/model"; export interface XRef { /** * Folds over the error and value types of the `XRef`. This is a highly * polymorphic method that is capable of arbitrarily transforming the error * and value types of the `XRef`. 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 ) => XRef; /** * Folds over the error and value types ofthe `XRef`, 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 ) => XRef; /** * Reads the value from the `XRef`. */ readonly get: EIO; /** * Writes a new value to the `XRef`, with a guarantee of immediate * consistency (at some cost to performance). */ readonly set: (a: A) => EIO; } export declare class DerivedAll implements XRef { readonly value: Atomic; readonly getEither: (s: S) => E.Either; readonly setEither: (a: A) => (s: S) => E.Either; readonly _tag = "DerivedAll"; constructor(value: Atomic, getEither: (s: S) => E.Either, setEither: (a: A) => (s: S) => E.Either); readonly fold: ( ea: (_: EA) => EC, eb: (_: EB) => ED, ca: (_: C) => E.Either, bd: (_: B) => E.Either ) => XRef; readonly foldAll: ( ea: (_: EA) => EC, eb: (_: EB) => ED, ec: (_: EB) => EC, ca: (_: C) => (_: B) => E.Either, bd: (_: B) => E.Either ) => XRef; readonly get: EIO; readonly set: (a: A) => EIO; } export declare class Derived implements XRef { readonly value: Atomic; readonly getEither: (s: S) => E.Either; readonly setEither: (a: A) => E.Either; readonly _tag = "Derived"; constructor(value: Atomic, getEither: (s: S) => E.Either, setEither: (a: A) => E.Either); readonly fold: ( ea: (_: EA) => EC, eb: (_: EB) => ED, ca: (_: C) => E.Either, bd: (_: B) => E.Either ) => XRef; readonly foldAll: ( ea: (_: EA) => EC, eb: (_: EB) => ED, ec: (_: EB) => EC, ca: (_: C) => (_: B) => E.Either, bd: (_: B) => E.Either ) => XRef; readonly get: EIO; readonly set: (a: A) => EIO; } export declare class Atomic implements XRef { readonly value: AtomicReference; readonly _tag = "Atomic"; readonly fold: ( _ea: (_: never) => EC, _eb: (_: never) => ED, ca: (_: C) => E.Either, bd: (_: A) => E.Either ) => XRef; readonly foldAll: ( _ea: (_: never) => EC, _eb: (_: never) => ED, _ec: (_: never) => EC, ca: (_: C) => (_: A) => E.Either, bd: (_: A) => E.Either ) => XRef; constructor(value: AtomicReference); get get(): IO; readonly set: (a: A) => T.IO; } /** * A Ref that can fail with error E */ export interface ERef extends XRef {} /** * A Ref that cannot fail */ export interface Ref extends ERef {} /** * Cast to a sealed union in case of ERef (where it make sense) */ export declare const concrete: ( self: XRef ) => Atomic | DerivedAll | Derived; //# sourceMappingURL=model.d.ts.map