import type * as HKT from "@principia/prelude/HKT"; import type * as Ac from "../Async"; import { _AI } from "../Async/constants"; import { _A, _E, _I, _R, _U, TaskInstructionTag } from "../Task/Task/constants"; import type * as T from "../Task/Task/model"; export declare const URI = "XPure"; export declare type URI = typeof URI; export declare type V = HKT.V<"S", "_"> & HKT.V<"R", "-"> & HKT.V<"E", "+">; declare module "@principia/prelude/HKT" { interface URItoKind { readonly [URI]: XPure; } } export declare const _XPI = "_XPI"; export declare type _XPI = typeof _XPI; /** * `XPure` is a purely functional description of a computation * that requires an environment `R` and an initial state `S1` and may either * fail with an `E` or succeed with an updated state `S2` and an `A`. Because * of its polymorphism `XPure` can be used to model a variety of effects * including context, state, and failure. */ export declare abstract class XPure { readonly _tag = TaskInstructionTag.Integration; readonly _asyncTag = "XPure"; readonly _S1: (_: S1) => void; readonly _S2: () => S2; readonly [_U]: T.URI; readonly [_E]: () => E; readonly [_A]: () => A; readonly [_R]: (_: R) => void; get [_I](): T.Instruction; get [_AI](): Ac.AsyncInstruction; get [_XPI](): Instruction; } export declare enum XPureInstructionTag { Succeed = "Succeed", Total = "Total", Partial = "Partial", Suspend = "Suspend", Fail = "Fail", Modify = "Modify", Chain = "Chain", Fold = "Fold", Asks = "Asks", Give = "Give" } export declare class SucceedInstruction extends XPure { readonly value: A; readonly _xptag = XPureInstructionTag.Succeed; constructor(value: A); } export declare class TotalInstruction extends XPure { readonly thunk: () => A; readonly _xptag = XPureInstructionTag.Total; constructor(thunk: () => A); } export declare class PartialInstruction extends XPure { readonly thunk: () => A; readonly onThrow: (u: unknown) => E; readonly _xptag = XPureInstructionTag.Partial; constructor(thunk: () => A, onThrow: (u: unknown) => E); } export declare class SuspendInstruction extends XPure { readonly factory: () => XPure; readonly _xptag = XPureInstructionTag.Suspend; constructor(factory: () => XPure); } export declare class FailInstruction extends XPure { readonly e: E; readonly _xptag = XPureInstructionTag.Fail; constructor(e: E); } export declare class ModifyInstruction extends XPure { readonly run: (s1: S1) => readonly [S2, A]; readonly _xptag = XPureInstructionTag.Modify; constructor(run: (s1: S1) => readonly [S2, A]); } export declare class ChainInstruction extends XPure { readonly ma: XPure; readonly f: (a: A) => XPure; readonly _xptag = XPureInstructionTag.Chain; constructor(ma: XPure, f: (a: A) => XPure); } export declare class FoldInstruction extends XPure< S1 & S5, S3 | S4, R & R1 & R2, E1 | E2, B | C > { readonly fa: XPure; readonly onFailure: (e: E) => XPure; readonly onSuccess: (a: A) => XPure; readonly _xptag = XPureInstructionTag.Fold; constructor( fa: XPure, onFailure: (e: E) => XPure, onSuccess: (a: A) => XPure ); } export declare class AsksInstruction extends XPure { readonly f: (r: R0) => XPure; readonly _xptag = XPureInstructionTag.Asks; constructor(f: (r: R0) => XPure); } export declare class GiveInstruction extends XPure { readonly fa: XPure; readonly r: R; readonly _xptag = XPureInstructionTag.Give; constructor(fa: XPure, r: R); } export declare type Instruction = | SucceedInstruction | FailInstruction | ModifyInstruction | ChainInstruction | FoldInstruction | AsksInstruction | GiveInstruction | SuspendInstruction | TotalInstruction | PartialInstruction; //# sourceMappingURL=model.d.ts.map