import { MonadInterface } from './monad.interface'; import { SemigroupInterface } from './semigroup.interface'; import { SetoidInterface } from './setoid.interface'; /** * Logical disjunction between `Right` and `Left`. * @interface EitherInterface */ export interface EitherInterface extends SetoidInterface, SemigroupInterface, MonadInterface { /** * @param {(x: T) => TLeft} f * @param {(x: T) => TRight} g * @returns {TLeft | TRight} */ fold(f: (x: T) => TLeft, g: (x: T) => TRight): any; /** * @returns {T} */ unsafeGet(): T; /** * map :: Functor f => f a ~> (a -> b) -> f b * @param {(e: T) => TNewResult} f * @returns {EitherInterface} */ map(f: (e: T) => TNewResult): EitherInterface; /** * of :: Applicative f => a -> f a * @param {TValue} x * @returns {EitherInterface} */ of(x: TNewValue): EitherInterface; /** * ap :: Apply f => f a ~> f (a -> b) -> f b * @returns {EitherInterface} * @param v */ ap(v: EitherInterface): EitherInterface; /** * chain :: Chain m => m a ~> (a -> m b) -> m b * @param {(x: TValue) => TNewValue} f * @returns {EitherInterface} */ chain(f: (x: T) => EitherInterface): EitherInterface; /** * concat :: Semigroup a => a ~> a -> a * @param {EitherInterface} x * @returns {EitherInterface} */ concat(x: EitherInterface): EitherInterface; /** * @param {T} x * @returns {EitherInterface} */ swap(x: T): EitherInterface; /** * @param {() => TNewResult} f * @returns {TNewResult} */ getOrElse(f: () => TNewResult): TNewResult; isLeft: boolean; isRight: boolean; }