import { Equals } from "@tsplus/stdlib/structure/Equals"; import { Hash } from "@tsplus/stdlib/structure/Hash"; import { HKT } from "@tsplus/stdlib/prelude/HKT"; import type { Lazy } from "@tsplus/stdlib/data/Function"; /** * `Eval` is a purely functional description of a computation. * * Note: while for general cases the `Sync` data type is preferrable, * this data type is designed for speed and low allocations, * it is internally used to suspend recursive procedures but can be * useful whenever you need a fast sync computation that cannot fail * and that doesn't require any environment. * * @tsplus type Eval */ export interface Eval { readonly _A: () => A; readonly _TypeId: unique symbol; } export type EvalInternal = Succeed | FlatMap | Suspend; export declare const EvalSym: unique symbol; export type EvalSym = typeof EvalSym; export declare const _A: unique symbol; export type _A = typeof _A; /** * @tsplus type Eval.Ops */ export interface EvalOps { $: EvalAspects; } export declare const Eval: EvalOps; /** * @tsplus type Eval.Aspects */ export interface EvalAspects { } /** * @tsplus unify Eval */ export declare function unifyEval>(self: X): Eval<[X] extends [Eval] ? AX : never>; export interface Succeed extends Eval { } export declare class Succeed implements Equals { readonly a: Lazy; readonly _tag = "Succeed"; readonly [EvalSym]: EvalSym; readonly [_A]: () => A; constructor(a: Lazy); [Equals.sym](that: unknown): boolean; [Hash.sym](): number; } export interface Suspend extends Eval { } export declare class Suspend implements Equals { readonly f: Lazy>; readonly _tag = "Suspend"; readonly [EvalSym]: EvalSym; readonly [_A]: () => A; constructor(f: Lazy>); [Equals.sym](that: unknown): boolean; [Hash.sym](): number; } export interface FlatMap extends Eval { } export declare class FlatMap implements Equals { readonly value: EvalInternal; readonly cont: (a: A) => EvalInternal; readonly _tag = "FlatMap"; readonly [EvalSym]: EvalSym; readonly [_A]: () => A; constructor(value: EvalInternal, cont: (a: A) => EvalInternal); [Equals.sym](that: unknown): boolean; [Hash.sym](): number; } export interface EvalF extends HKT { readonly type: Eval; } export declare namespace Eval { type HKT = EvalF; } //# sourceMappingURL=definition.d.ts.map