Antelude.Tuple.Pair
Description
type Pair a b = (a, b) Source #
A two-element Tuple
curry :: ((a, b) -> c) -> a -> b -> c #
curry converts an uncurried function to a curried function.
curry
>>> curry fst 1 2 1
>>>
curry fst 1 2
first :: Pair a b -> a Source #
Get the first item of a Pair Tuple
Pair
mapFirst :: (a -> z) -> Pair a b -> Pair z b Source #
Apply a function to the first item of a Pair Tuple
mapSecond :: (b -> z) -> Pair a b -> Pair a z Source #
Apply a function to the second item of a Pair Tuple
pack :: a -> b -> Pair a b Source #
Pack both arguments into a Pair Tuple
second :: Pair a b -> b Source #
Get the second item of a Pair Tuple
swap :: Pair a b -> Pair b a Source #
Swap the items in a Pair Tuple
uncurry :: (a -> b -> c) -> (a, b) -> c #
uncurry converts a curried function to a function on pairs.
uncurry
>>> uncurry (+) (1,2) 3
uncurry (+) (1,2)
>>> uncurry ($) (show, 1) "1"
uncurry ($) (show, 1)
>>> map (uncurry max) [(1,2), (3,4), (6,8)] [2,4,8]
map (uncurry max) [(1,2), (3,4), (6,8)]