Class Pair<A, B>

A pair of values.

Type Parameters

  • out A

  • out B

Hierarchy

  • Pair

Constructors

Properties

Accessors

Methods

Constructors

  • Type Parameters

    • out A

    • out B

    Parameters

    • fst: A
    • snd: B

    Returns Pair<A, B>

Properties

fst: A

The first value of this Pair.

snd: B

The second value of this Pair.

Accessors

  • get val(): [A, B]
  • A 2-tuple of the first value and second value of this Pair.

    Returns [A, B]

Methods

  • Combine the first values and second values of this and that Pair pairwise.

    Type Parameters

    Parameters

    Returns Pair<A, B>

  • Compare this and that Pair to determine their ordering.

    Type Parameters

    • A extends Ord<A>

    • B extends Ord<B>

    Parameters

    Returns Ordering

    Remarks

    When ordered, Pair compares first values and second values lexicographically.

  • Compare this and that Pair to determine their equality.

    Type Parameters

    • A extends Eq<A>

    • B extends Eq<B>

    Parameters

    Returns boolean

    Remarks

    Two Pair are equal if their first values are equal and their second values are equal.

  • Apply a function to map the first value of this Pair.

    Type Parameters

    • A1

    Parameters

    • f: ((val) => A1)
        • (val): A1
        • Parameters

          • val: A

          Returns A1

    Returns Pair<A1, B>

  • Apply a function to map the second value of this Pair.

    Type Parameters

    • B1

    Parameters

    • f: ((val) => B1)
        • (val): B1
        • Parameters

          • val: B

          Returns B1

    Returns Pair<A, B1>

  • Apply a function to extract the first value and second value out of this Pair.

    Type Parameters

    • T

    Parameters

    • f: ((fst, snd) => T)
        • (fst, snd): T
        • Parameters

          • fst: A
          • snd: B

          Returns T

    Returns T

  • Construct a Pair from a 2-tuple of values.

    Type Parameters

    • A

    • B

    Parameters

    • tuple: readonly [A, B]

    Returns Pair<A, B>

Generated using TypeDoc