Extensions for tuples.
indexedPair : (a -> b) -> a -> ( b, a )
Turn a items into a key-value pair.
See also Exts.Dict.indexBy
and Exts.Dict.groupBy
.
both : (a -> b) -> ( a, a ) -> ( b, b )
Update both components of a pair with a single function.
pair : (a -> b) -> (x -> y) -> ( a, x ) -> ( b, y )
Update both components of a pair with two functions.
fork : (a -> b) -> (a -> c) -> a -> ( b, c )
Generate a pair from a single value and a left & right function.
onFirst : (a -> b -> c) -> ( a, b ) -> ( c, b )
Apply a function that considers both elements of a pair and changes the first.
onSecond : (a -> b -> c) -> ( a, b ) -> ( a, c )
Apply a function that considers both elements of a pair and changes the second.