Class SyntaxAbstract

The fluent syntax for Either.

Hierarchy

Constructors

Properties

kind: Either.Kind

The property that discriminates Either.

Methods

  • If this and that Either are Right, combine their values.

    Type Parameters

    Parameters

    Returns Either<E, T>

  • Compare this and that Either to determine their ordering.

    Type Parameters

    • A extends Ord<A>

    • B extends Ord<B>

    Parameters

    Returns Ordering

    Remarks

    When ordered, Left always compares as less than Right. If the variants are the same, their values are compared to determine the ordering.

  • Compare this and that Either to determine their equality.

    Type Parameters

    • A extends Eq<A>

    • B extends Eq<B>

    Parameters

    Returns boolean

    Remarks

    Two Either are equal if they are the same variant and their values are equal.

  • If this Either is Right, ignore its value and return that Either.

    Type Parameters

    • E

    • E1

    • T1

    Parameters

    Returns Either<E | E1, T1>

  • If this Either is Right, apply a function to its value to return another Either.

    Type Parameters

    • E

    • T

    • E1

    • T1

    Parameters

    Returns Either<E | E1, T1>

  • If this Either is Right, apply a generator function to its value to return another Either.

    Type Parameters

    • E

    • T

    • E1

    • T1

    Parameters

    Returns Either<E | E1, T1>

  • If this Either is Left, apply a function to map its value.

    Type Parameters

    • A

    • B

    • A1

    Parameters

    • this: Either<A, B>
    • f: ((val) => A1)
        • (val): A1
        • Parameters

          • val: A

          Returns A1

    Returns Either<A1, B>

  • If this Either is Right, apply a function to map its value.

    Type Parameters

    • A

    • B

    • B1

    Parameters

    • this: Either<A, B>
    • f: ((val) => B1)
        • (val): B1
        • Parameters

          • val: B

          Returns B1

    Returns Either<A, B1>

  • If this Either is Left, ignore its value and return that Either.

    Type Parameters

    • T

    • E1

    • T1

    Parameters

    Returns Either<E1, T | T1>

  • If this Either is Left, apply a function to its value to return another Either.

    Type Parameters

    • E

    • T

    • E1

    • T1

    Parameters

    Returns Either<E1, T | T1>

  • Apply one of two functions to extract the value out of this Either depending on the variant.

    Type Parameters

    • A

    • B

    • T1

    • T2

    Parameters

    • this: Either<A, B>
    • unwrapLeft: ((val) => T1)
        • (val): T1
        • Parameters

          • val: A

          Returns T1

    • unwrapRight: ((val) => T2)
        • (val): T2
        • Parameters

          • val: B

          Returns T2

    Returns T1 | T2

  • If this and that Either are Right, apply a function to combine their values.

    Type Parameters

    • E

    • T

    • E1

    • T1

    • T2

    Parameters

    • this: Either<E, T>
    • that: Either<E1, T1>
    • f: ((lhs, rhs) => T2)
        • (lhs, rhs): T2
        • Parameters

          • lhs: T
          • rhs: T1

          Returns T2

    Returns Either<E | E1, T2>

Generated using TypeDoc