UNPKG

@jsoldi/hkt

Version:

Higher kinded types for typescript and a few utility monads.

38 lines 1.96 kB
import { IMonad } from "../../classes/monad.js"; import { $I } from "../../core/hkt.js"; import { IFunctorFree } from "../free/functorFree.js"; import { IMonadFree } from "../free/monadFree.js"; import { KLazy } from "../lazy.js"; import { KTask } from "../task.js"; import { ICont } from "./contCore.js"; import { IContFunctorFree } from "./contFunctorFree.js"; import { IContMonad } from "./contMonad.js"; import { IContMonadFree } from "./contMonadFree.js"; import { IContVoid } from "./contVoid.js"; /** The continuation factory. */ export interface IContFactory { /** The identity continuation, where computations immediately return a value. */ readonly trivial: IContMonad<$I>; /** The void continuation, where computations do not return a value. */ readonly void: IContVoid; /** The trampoline continuation for stack-safe recursion. */ readonly trampoline: IContMonadFree<KLazy>; /** The trampoline continuation for stack-safe async recursion. */ readonly trampolineAsync: IContMonadFree<KTask>; /** Creates a continuation monad where results are wrapped in type `M`. */ ofType<M>(): ICont<M>; /** Creates a continuation monad where results are wrapped in a monad. */ ofMonad<M>(m: IMonad<M>): IContMonad<M>; /** Creates a continuation monad where results are wrapped in a free monad given a functor. */ ofFunctorFree<M>(m: IFunctorFree<M>): IContFunctorFree<M>; /** Creates a continuation monad where results are wrapped in a free monad given a monad. */ ofMonadFree<M>(m: IMonadFree<M>): IContMonadFree<M>; } /** The continuation factory. */ export declare const cont: IContFactory; export { Cont, KCont, ICont } from "./contCore.js"; export { IContVoid, ContVoid } from "./contVoid.js"; export { IContMonad } from "./contMonad.js"; export { IContFunctorFree, ContFree } from "./contFunctorFree.js"; export { IContMonadFree } from "./contMonadFree.js"; //# sourceMappingURL=cont.d.ts.map