pragmatic-fp-ts
Version:
Opinionated functional programming library with easy use in mind
11 lines (10 loc) • 680 B
TypeScript
import { Chain, Either, Maybe } from "./main";
import { Monad } from "./types";
declare function bind<A, B>(f: (_: A) => B): <M extends Monad<A>>(_: M) => M extends Maybe<A> ? Maybe<B> : M extends Chain<any> ? Chain<B> : Either<B, any>;
declare function bindM<A, B>(f: (_: A) => Maybe<B>): (_: Maybe<A>) => Maybe<B>;
declare function bindM<A, B>(f: (_: A) => Either<B>): (_: Either<A>) => Either<B>;
declare function bindM<A, B>(f: (_: A) => Chain<B>): (_: Chain<A>) => Chain<B>;
declare function lift<A>(_: Maybe<Monad<A>>): Maybe<A>;
declare function lift<A>(_: Either<Monad<A>>): Either<A>;
declare function lift<A>(_: Chain<Monad<A>>): Chain<A>;
export { bind, bindM, lift };