import Optional from 'typescript-optional'; export declare enum EitherType { Left = 0, Right = 1 } export interface EitherPatterns { left: (l: L) => T; right: (r: R) => T; } export declare function either(l?: L, r?: R): Either; export interface LeftTransformer { left(x: L): N; } export declare function leftUnitTransformer(): LeftTransformer>; export declare function leftPromiseTransformer(): LeftTransformer>>; /** * @name Either * @class Either has exactly two sub types, Left (L) and Right (R). If an * Either object contains an instance of L, then the Either is a * Left. Otherwise it contains an instance of R and is a Right. By * convention, the Left constructor is used to hold an error value and * the Right constructor is used to hold a correct value. */ export declare class Either { private type; private l?; private r?; constructor(type: EitherType, l?: L, r?: R); static left(l: L): Either; static right(r: R): Either; isLeft(): boolean; isRight(): boolean; unit(t: T): Either; flatMap(f: (r: R) => Either): Either; flatMap(f: (r: R) => N, transf: LeftTransformer): N; of: (t: T) => Either; map(f: (r: R) => T): Either; caseOf(pattern: EitherPatterns): T; toRight(): Optional; toLeft(): Optional; }