Interface Right<R, L>

Right (correct) value of type R

Either data type specialization representing a correct value

interface Right<R, L> {
    generator: EitherGeneratorFunction<[], R, Right<R, L>, R>;
    right: R;
    chain<R2, L2>(this, op): Right<R2, never>;
    chain<R2, L2>(this, op): Left<never, L2>;
    chain<R2, L2>(this, op): Either<R2, L2>;
    chain<R2, L2>(this, op): Either<R2, L>;
    chain<R2, L2>(this, op): Left<never, L | L2>;
    chain<R2, L2>(this, op): Either<R2, L | L2>;
    isLeft(): this is Left<R, L>;
    isRight(): this is Right<R, L>;
    map<R2>(this, op): Right<R2, never>;
    map<R2>(this, op): Either<R2, L>;
    matchChain<R2, L2, R3, L3>(this, op): Right<R2, never>;
    matchChain<R2, L2, R3, L3>(this, op): Left<never, L2>;
    matchChain<R2, L2, R3, L3>(this, op): Right<R2, never>;
    matchChain<R2, L2, R3, L3>(this, op): Left<never, L2>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R2, L2>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R2, L2>;
    matchChain<R2, L2, R3, L3>(this, op): Right<R2, never>;
    matchChain<R2, L2, R3, L3>(this, op): Left<never, L2>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R2, L2>;
    matchChain<R2, L2, R3, L3>(this, op): Right<R2 | R3, never>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R3, L2>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R2, L3>;
    matchChain<R2, L2, R3, L3>(this, op): Left<never, L2 | L3>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R2 | R3, L2>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R2, L2 | L3>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R2 | R3, L3>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R3, L2 | L3>;
    matchChain<R2, L2, R3, L3>(this, op): Either<R2 | R3, L2 | L3>;
    matchMap<R2, R3>(this, op): Right<R2, never>;
    matchMap<R2, R3>(this, op): Right<R2 | R3, never>;
    matchTap(op): this;
    orChain<R2, L2>(this, op): Right<R, never>;
    orChain<R2, L2>(this, op): Right<R, never>;
    orChain<R2, L2>(this, op): Right<R, never>;
    orChain<R2, L2>(this, op): Right<R | R2, never>;
    orChain<R2, L2>(this, op): Either<R, L2>;
    orChain<R2, L2>(this, op): Either<R | R2, L2>;
    orMap<R2>(this, op): Right<R, never>;
    orMap<R2>(this, op): Right<R | R2, never>;
    orTap(op): this;
    tap(op): this;
}

Type Parameters

  • R

    underlying value type

  • L

    underlying error type (needed for type merging, in fact alwas considered to be never)

Properties

generator: EitherGeneratorFunction<[], R, Right<R, L>, R>

Wrap Maybe to singleton generator

Userful in order to avoid ambiguous yied types

Returns

generator of Maybe wrapping this

right: R

Methods

  • Either type guard for 'left'

    Returns this is Left<R, L>

    'true' in case this is 'left error' (and resolves type to be 'left')

    Example

    if (either.isLeft()) {
    console.error(either.left)
    }
  • Either type guard for 'right'

    Returns this is Right<R, L>

    'true' in case this is 'right value' (and resolves type to be 'right')

    Example

    if (either.isRight()) {
    console.log(either.right)
    }
  • Either transformer function

    Applied to 'right value' returns 'right op(value)' Applied to 'left error' returns self without invoking transformer

    Type Parameters

    • R2

      transformer function's return type

    Parameters

    • this: Right<R, L>
    • op: ((value) => R2)

      transformer to be invoked with underlying value

        • (value): R2
        • Parameters

          • value: R

          Returns R2

    Returns Right<R2, never>

    'right op(value)' or 'left error'

  • Type Parameters

    • R2

    Parameters

    • this: Either<R, L>
    • op: ((value) => R2)
        • (value): R2
        • Parameters

          • value: R

          Returns R2

    Returns Either<R2, L>

  • Either pattern matching transformer function

    Applied to 'right value' returns 'right op.right(value)' Applied to 'left error' returns 'right op.left(error)'

    Type Parameters

    • R2

      right transformer function's return type

    • R3 = R2

      left transformer function's return type

    Parameters

    • this: Right<R, L>
    • op: {
          left: ((error) => R3);
          right: ((value) => R2);
      }
      • left: ((error) => R3)

        transformer to be invoked with underlying error in case of 'left'

          • (error): R3
          • transformer to be invoked with underlying error in case of 'left'

            Parameters

            • error: L

            Returns R3

      • right: ((value) => R2)

        transformer to be invoked with underlying value in case of 'right'

          • (value): R2
          • transformer to be invoked with underlying value in case of 'right'

            Parameters

            • value: R

            Returns R2

    Returns Right<R2, never>

    'right op.right(value)' or 'right op.left(error)'

  • Type Parameters

    Parameters

    • this: Either<R, L>
    • op: {
          left: ((error) => R3);
          right: ((value) => R2);
      }
      • left: ((error) => R3)
          • (error): R3
          • Parameters

            • error: L

            Returns R3

      • right: ((value) => R2)
          • (value): R2
          • Parameters

            • value: R

            Returns R2

    Returns Right<R2 | R3, never>

  • Either pattern matching peeker function

    Applied to 'right value' returns self invoking op.right(value) in process Applied to 'left error' returns self invoking op.left(error) in process

    Parameters

    • op: {
          left: ((error) => void);
          right: ((value) => void);
      }
      • left: ((error) => void)

        function to be invoked with underlying error in case of 'left'

          • (error): void
          • function to be invoked with underlying error in case of 'left'

            Parameters

            • error: L

            Returns void

      • right: ((value) => void)

        function to be invoked with underlying value in case of 'right'

          • (value): void
          • function to be invoked with underlying value in case of 'right'

            Parameters

            • value: R

            Returns void

    Returns this

    self

  • Either fallback transformer function

    Applied to 'right value' returns self without invoking transformer Applied to 'left error' returns 'right op(error)'

    Type Parameters

    • R2

    Parameters

    • this: Right<R, L>
    • op: ((error) => R2)

      transformer to be invoked with underlying error

        • (error): R2
        • Parameters

          • error: L

          Returns R2

    Returns Right<R, never>

    'right value' or 'right op(error)'

  • Type Parameters

    • R2

    Parameters

    • this: Either<R, L>
    • op: ((error) => R2)
        • (error): R2
        • Parameters

          • error: L

          Returns R2

    Returns Right<R | R2, never>

  • Either fallback peeker function

    Applied to 'right value' returns self without invoking callback Applied to 'left error' returns self invoking op(error) in process

    Parameters

    • op: ((error) => void)

      function to be invoked with underlying error

        • (error): void
        • Parameters

          • error: L

          Returns void

    Returns this

    self

  • Either peeker function

    Applied to 'right value' returns self invoking op(value) in process Applied to 'left error' returns self without invoking callback

    Parameters

    • op: ((value) => void)

      function to be invoked with underlying value

        • (value): void
        • Parameters

          • value: R

          Returns void

    Returns this

    self

Generated using TypeDoc