import * as fun from "https://deno.land/x/fun@v2.0.0/pair.ts";
Pair represents a pair of values. It can be thought of as a tuple of two, or first and second, or separated values.
Variables
The canonical Bimappable instance for Pair. Contains the bimap and mapSecond methods. | |
The canonical Foldable instance for Pair. Contains the fold method. | |
The canonical Mappable instance for Pair. Contains the map method. | |
Functions
Creates a new pair by mapping first through the fai function and second through the fbj function. | |
f dup | Creates a pair from a single type |
A curried form of the pair constructor, starting with the first value of a pair. | |
f fold | Reduces a pair with an initial value, also passing the second value into the foldr as well. |
Extracts the first value from a Pair. | |
Creates a Flatmappable instance for Pair where the second parameter is concatenated according to the Monoid instance passed in. | |
Extracts the second value from a Pair. | |
Creates a Showable instance for a pair, wrapping the Showable instances provided for the first and second values. | |
f map | Creates a new Pair with the same second value and a new first value determined by the output of the fai function. |
Creates a new Pair with the same first value and a new second value determined by the output of the fbj function. | |
Apply a function in the first position of a pair to a value in the second position of a pair. | |
Apply a function in the first position of a pair to a value in the second position of a pair. | |
f pair | Creates a Pair from two values first and second with types A and B respectively. Used to quickly construct a Pair. |
A curried form of the pair constructor, starting with the second value of a pair. | |
f swap | Creates a new Pair with the first and second values swapped. |
Traverse a pair using another algebraic structure's Applicable. | |
Just like the first function, unwrap returns the first value in a pair. |
Interfaces
Specifies Pair as a Higher Kinded Type, with covariant parameters A and B corresponding to the 0th and 1st index of any Substitutions. | |
A Kind implementation used to fix the second parameter in a Pair. Otherwise it operates the same as Pair does. |
Type Aliases
T Pair | Pair represents a pair of values. This is equivalent to a Tuple of length two, the Separated type in fp-ts, and any other type that contains exactly two covariant other types. |