Basic Monad Interface

interface Validation<E, T> {
    @@type: string;
    acc(): Validation<E, IValidationAcc>;
    ap<V>(eitherFn: Validation<E, ((val: T) => V)>): Validation<E, V>;
    apTo<V>(value: Validation<E, V>): T extends ((arg: V) => any)
        ? Validation<E, ReturnType<T<T>>>
        : never;
    bimap<F, V>(fnF: ((fail: E) => F), fnS: ((val: T) => V)): Validation<F, V>;
    bind<V>(fn: ((val: T) => Validation<E, V>)): Validation<E, V>;
    cata<Z>(failFn: ((fail: E) => Z), successFn: ((val: T) => Z)): Z;
    catchMap<F>(fn: ((fail: E) => Validation<F, T>)): Validation<F, T>;
    chain<V>(fn: ((val: T) => Validation<E, V>)): Validation<E, V>;
    equals(other: Validation<E, T>): boolean;
    fail(): E;
    failMap<F>(fn: ((fail: E) => F)): Validation<F, T>;
    fantasy-land/ap?<V>(afn: Applicative<((val: T) => V)>): Applicative<V>;
    fantasy-land/chain?<V>(fn: ((val: T) => Chain<V>)): Chain<V>;
    fantasy-land/equals?(other: Validation<E, T>): boolean;
    fantasy-land/map?<V>(fn: ((val: T) => V)): Functor<V>;
    flatMap<V>(fn: ((val: T) => Validation<E, V>)): Validation<E, V>;
    fold<Z>(failFn: ((fail: E) => Z), successFn: ((val: T) => Z)): Z;
    foldLeft<V>(initial: V): ((fn: ((acc: V, val: T) => V)) => V);
    foldRight<V>(initial: V): ((fn: ((val: T, acc: V) => V)) => V);
    forEach(fn: ((val: T) => void)): void;
    forEachFail(fn: ((val: E) => void)): void;
    isFail(): boolean;
    isSuccess(): boolean;
    join<V>(): Validation<E, V>;
    map<V>(fn: ((val: T) => V)): Validation<E, V>;
    success(): T;
    swap(): Validation<T, E>;
    takeLeft(m: Validation<E, T>): Validation<E, T>;
    takeRight(m: Validation<E, T>): Validation<E, T>;
    toEither(): Either<E, T>;
    toMaybe(): Maybe<T>;
}

Type Parameters

  • E
  • T

Hierarchy-Diagram

UML class diagram of Validation
Legend
icon for an interface in the UML class diagram interface
icon for a public method in the UML class diagram public method

Hierarchy (view full)

Properties

@@type: string

Methods

  • Type Parameters

    • F
    • V

    Parameters

    • fnF: ((fail: E) => F)
        • (fail: E): F
        • Parameters

          • fail: E

          Returns F

    • fnS: ((val: T) => V)
        • (val: T): V
        • Parameters

          • val: T

          Returns V

    Returns Validation<F, V>

  • Type Parameters

    • Z

    Parameters

    • failFn: ((fail: E) => Z)
        • (fail: E): Z
        • Parameters

          • fail: E

          Returns Z

    • successFn: ((val: T) => Z)
        • (val: T): Z
        • Parameters

          • val: T

          Returns Z

    Returns Z

  • Returns E

  • Type Parameters

    • F

    Parameters

    • fn: ((fail: E) => F)
        • (fail: E): F
        • Parameters

          • fail: E

          Returns F

    Returns Validation<F, T>

  • Type Parameters

    • V

    Parameters

    • fn: ((val: T) => V)
        • (val: T): V
        • Parameters

          • val: T

          Returns V

    Returns Functor<V>

  • Type Parameters

    • Z

    Parameters

    • failFn: ((fail: E) => Z)
        • (fail: E): Z
        • Parameters

          • fail: E

          Returns Z

    • successFn: ((val: T) => Z)
        • (val: T): Z
        • Parameters

          • val: T

          Returns Z

    Returns Z

  • Type Parameters

    • V

    Parameters

    • initial: V

    Returns ((fn: ((acc: V, val: T) => V)) => V)

      • (fn: ((acc: V, val: T) => V)): V
      • Parameters

        • fn: ((acc: V, val: T) => V)
            • (acc: V, val: T): V
            • Parameters

              • acc: V
              • val: T

              Returns V

        Returns V

  • Type Parameters

    • V

    Parameters

    • initial: V

    Returns ((fn: ((val: T, acc: V) => V)) => V)

      • (fn: ((val: T, acc: V) => V)): V
      • Parameters

        • fn: ((val: T, acc: V) => V)
            • (val: T, acc: V): V
            • Parameters

              • val: T
              • acc: V

              Returns V

        Returns V

  • Parameters

    • fn: ((val: T) => void)
        • (val: T): void
        • Parameters

          • val: T

          Returns void

    Returns void

  • Parameters

    • fn: ((val: E) => void)
        • (val: E): void
        • Parameters

          • val: E

          Returns void

    Returns void

  • Returns boolean

  • Returns boolean

  • Type Parameters

    • V

    Parameters

    • fn: ((val: T) => V)
        • (val: T): V
        • Parameters

          • val: T

          Returns V

    Returns Validation<E, V>

  • Returns T

  • Returns Either<E, T>

  • Returns Maybe<T>