import * as fun from "https://raw.githubusercontent.com/baetheus/fun/main/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.
BimappablePair | The canonical Bimappable instance for Pair. Contains the bimap and mapSecond methods. |
FoldablePair | The canonical Foldable instance for Pair. Contains the fold method. |
MappablePair | The canonical Mappable instance for Pair. Contains the map method. |
TraversablePair |
bimap | Creates a new pair by mapping first through the fai function and second through the fbj function. |
dup | Creates a pair from a single type |
first | A curried form of the pair constructor, starting with the first value of a pair. |
fold | Reduces a pair with an initial value, also passing the second value into the foldr as well. |
getCombinablePair | |
getComparablePair | |
getFirst | Extracts the first value from a Pair. |
getInitializablePair | |
getRightFlatmappable | Creates a Flatmappable instance for Pair where the second parameter is concatenated according to the Monoid instance passed in. |
getSecond | Extracts the second value from a Pair. |
getShowablePair | Creates a Showable instance for a pair, wrapping the Showable instances provided for the first and second values. |
getSortablePair | |
map | Creates a new Pair with the same second value and a new first value determined by the output of the fai function. |
mapSecond | Creates a new Pair with the same first value and a new second value determined by the output of the fbj function. |
merge | Apply a function in the first position of a pair to a value in the second position of a pair. |
mergeSecond | Apply a function in the first position of a pair to a value in the second position of a pair. |
pair | Creates a Pair from two values first and second with types A and B respectively. Used to quickly construct a Pair. |
second | A curried form of the pair constructor, starting with the second value of a pair. |
swap | Creates a new Pair with the first and second values swapped. |
traverse | Traverse a pair using another algebraic structure's Applicable. |
unwrap | Just like the first function, unwrap returns the first value in a pair. |
KindPair | Specifies Pair as a Higher Kinded Type, with covariant parameters A and B corresponding to the 0th and 1st index of any Substitutions. |
KindRightPair | A Kind implementation used to fix the second parameter in a Pair. Otherwise it operates the same as Pair does. |