import {BinaryCurriedFn} from './common'; export function all(promises: Array>): Promise>; export function ap(mfn: Promise<(a: A) => B>, mb: Promise): Promise; export function ap(mfn: Promise<(a: A) => B>): (mb: Promise) => Promise; export function bi_tap(onFailure: (e: any) => void, onSuccess: (t?: T) => any, p: Promise): Promise; export function bi_tap(onFailure: (e: any) => void, onSuccess: (t?: T) => any): (p: Promise) => Promise; // coalesce :: (e -> b) -> (a -> b) -> Promise e a -> Promise e b export function coalesce(onFailure: (e: any) => B, onSuccess: (a?: A) => B, p: Promise): Promise; export function coalesce(onFailure: (e: any) => B, onSuccess: (a?: A) => B): (p: Promise) => Promise; /** * Produce a Promise from the factory function and the resolution value of the promise */ export function chain(factory: (x?: T) => Promise, p: Promise) : Promise; export function chain(factory: (x?: T) => Promise): (p: Promise) => Promise; // chainRej :: (e -> Promise g a) -> Promise e a -> Promise g b export function chainRej(onError: (e: any) => Promise, p: Promise) : Promise; export function chainRej(onError: (e: any) => Promise): (p: Promise) => Promise; export function chainTap(fn: (x?: T) => Promise, p: Promise): Promise; export function chainTap(fn: (x?: T) => Promise): (p: Promise) => Promise; export function duplexRace(a: Promise, b: Promise): Promise; export function duplexRace(a: Promise): (b: Promise) => Promise; export function later(dt: number, a: A): Promise; export function later(dt: number): (a: A) => Promise; /** * Makes a binary curried function accept and return Promises Types instead of Types */ export function liftA2(fn: BinaryCurriedFn, ps: Promise, pt: Promise): Promise; export function liftA2(fn: BinaryCurriedFn): (ps: Promise, pt: Promise) => Promise; export function liftA2(fn: BinaryCurriedFn): (ps: Promise) => (pt: Promise) => Promise; /** * Maps the success value of the Promise to the return value of the function. */ export function map(fn: (x?: T) => U, p: Promise): Promise; export function map(fn: (x?: T) => U): (p: Promise) => Promise; export function mapRej(fn: (e: any) => any, p: Promise): Promise; export function mapRej(fn: (e: any) => any): (p: Promise) => Promise; export function of(x: T): Promise; /** * calls the function with the success value, ignoring the return value. * Useful for side-effects. */ export function tap(fn: (x?: T) => any, p: Promise): Promise; export function tap(fn: (x?: T) => any): (p: Promise) => Promise; export function tapRegardless(fn: (x?: T) => any, p: Promise): Promise; export function tapRegardless(fn: (x?: T) => any): (p: Promise) => Promise; export function reject(payload: any): Promise;