import { EitherInterface } from './interfaces/either.interface'; import { Left } from './left'; /** * @class Right */ export declare class Right implements EitherInterface { /** * Lift a value into Either. * @param {TNewValue} x * @returns {Right} */ static of(x: TNewValue): Right; /** * @returns {any} */ static readonly [Symbol.species]: any; /** * Internally stored value. */ protected readonly _value: T; /** * @constructor * @param {T} x */ constructor(x: T); /** * Apply the function value of current Either to another Either. * @param {Right} v * @returns {Right} */ ap(v: EitherInterface): EitherInterface; /** * Transform the Right value of the Either using a unary function to monad. * @param {(x: T) => Right} f * @returns {Right} */ chain(f: (x: T) => EitherInterface): EitherInterface; /** * Concat the Right value of the Either with another Right or keep Left on either side. * @param {Right} x * @returns {Right} */ concat(x: EitherInterface): Right; /** * Transform internal value of the either. * @param {(e: T) => TNewResult} f * @returns {FunctorInterface} */ map(f: (x: T) => TNewResult): Right; /** * Lift a value into Either. * @param {TNewValue} x * @returns {Right} */ of(x: TNewValue): Right; /** * Unsafely get internal value of the Either. * @returns {T} */ unsafeGet(): T; /** * Swap disjunction values. * @returns {Left} */ swap(): Left; /** * Get value fot the Either if in its Rightmost case or run provided function. * @param {(x: T) => TNewResult} f * @returns {T} */ getOrElse(f: (x?: T) => TNewResult): TNewResult; /** * Safely get value of the Either. * @param {(x: T) => TLeftResult} f * @param {(x: T) => TRightResult} g * @returns {any} */ fold(f: (x: T) => any, g: (x: T) => TRightResult): TRightResult; /** * Test if the Either equals another Either. * @param {Right} x * @returns {boolean} */ equals(x: Right): boolean; /** * Approval for Either to be Right. * @returns {boolean} */ readonly isRight: boolean; /** * Approval for Either to be Left. * @returns {boolean} */ readonly isLeft: boolean; /** * @returns {string} */ toString(): string; }