UNPKG

@jsoldi/hkt

Version:

Higher kinded types for typescript and a few utility monads.

21 lines 992 B
import { $, $3, $I } from "../core/hkt.js"; import { IMonad, IMonadBase } from "./monad.js"; import { TypeClassArg } from "./utilities.js"; /** The minimal definition of a transformed monad. */ export interface IMonadTransBase<T, M> extends IMonadBase<$<T, M>> { lift<A>(ma: $<M, A>): $3<T, M, A>; wrap<A>(ta: $<$<T, $I>, A>): $3<T, M, A>; } /** The transformed monad interface. */ export interface IMonadTrans<T, M> extends IMonadTransBase<T, M>, IMonad<$<T, M>> { flatten<A>(fa: $<M, $3<T, M, A>>): $3<T, M, A>; } /** A monad that can transform another monad. */ export interface ITransformer<T> { transform<M>(base: IMonad<M>): IMonadTrans<T, M>; } declare const is_monadTrans: unique symbol; /** Creates a monad that can transform another monad from an `IMonadTransBase`. */ export declare function monadTrans<T, M>(base: TypeClassArg<IMonadTransBase<T, M>, IMonadTrans<T, M>, typeof is_monadTrans>): IMonadTrans<T, M>; export {}; //# sourceMappingURL=transformer.d.ts.map