import {BinaryCurriedFn, Opaque, PlainObjectOf, TernaryCurriedFn} from './common'; import {Maybe} from "./maybe"; export type Left = Opaque<"Left", void>; export type Right = Opaque<"Right", T>; export type Either = Left | Right; type Applicative = Promise|Maybe|PlainObjectOf; export function right(a: A): Right; export function of(a: A): Right; export function left(e: any): Left; export function fromAssertedValue(predicate: (a:A) => boolean, makeLeftValue: (a:A) => B, a: A): Either; export function fromAssertedValue(predicate: (a:A) => boolean): (makeLeftValue: (a:A) => B, a: A) => Either; export function fromAssertedValue(predicate: (a:A) => boolean, makeLeftValue: (a:A) => B): (a: A) => Either; export function fromAssertedValue(predicate: (a:A) => boolean): (makeLeftValue: (a:A) => B) => (a: A) => Either; export function fromThrowable(generate: (a: A) => B): (a: A) => Either; export function fromThrowable(generate: (a: A) => B, a: A): Either; export function fromThrowable(generate: (a1: A1, a2: A2) => B): (a1: A1, a2: A2) => Either; /** @deprecated Use FL compliant utility function e.g. R.map */ export function map(fn: (x: T) => U, mx: Either): Either; /** @deprecated Use FL compliant utility function e.g. R.map */ export function map(fn: (x: T) => U) : (mx: Either) => Either; export function bimap(fnLeft: (e: any) => any, fn: (x: T) => U): (mx: Either) => Either; export function bi_tap(fnLeft: (e: any) => void, fn: (x: T) => void): (mx: Either) => Either; /** @deprecated Use FL compliant utility function e.g. R.chain */ export function chain(factory: (x: T) => Either, p: Either) : Either; /** @deprecated Use FL compliant utility function e.g. R.chain */ export function chain(factory: (x: T) => Either): (p: Either) => Either; export function chainLeft(factory: (e: any) => Either, p: Either) : Either; export function chainLeft(factory: (e: any) => Either): (p: Either) => Either; export function either(onLeft: (c?: any) => B, onRight: (a: A) => B, m: Either): B; export function either(onLeft: () => B, onRight: (a: A) => B): (m: Either) => B; export function either(onLeft: (c: any) => B, onRight: (a: A) => B): (m: Either) => B; export function either(onLeft: (c: any) => B): (onRight: (a: A) => B) => (m: Either) => B; export function isEither(me: any): boolean; export function isRight(me: Either): boolean; export function isLeft(me: Either): boolean; export function join(me: Either>): Either; export function sequence( ofF: (a: A) => Applicative, mapF: (f: (a: A) => B, ma: Applicative) => Applicative, mfa: Either>): Applicative>; export function sequence( ofF: (a: A) => Applicative, mapF: (f: (a: A) => B, ma: Applicative) => Applicative): (mfa: Either>) => Applicative>; export function traverse( ofF: (a: A) => Applicative, mapF: (f: (a: A) => B, ma: Applicative) => Applicative, effect: (a: A) => Applicative, ma: Either): Applicative>; export function traverse( ofF: (a: A) => Applicative, mapF: (f: (a: A) => B, ma: Applicative) => Applicative, effect: (a: A) => Applicative): (ma: Either) => Applicative>; export function traverse( ofF: (a: A) => Applicative, mapF: (f: (a: A) => B, ma: Applicative) => Applicative): (effect: (a: A) => Applicative, ma: Either) => Applicative>; export function traverse( ofF: (a: A) => Applicative, mapF: (f: (a: A) => B, ma: Applicative) => Applicative): (effect: (a: A) => Applicative) => (ma: Either) => Applicative>;