extra-0.3.2: Extra functions I use.

Safe HaskellSafe-Inferred

Data.Tuple.Extra

Contents

Description

Extra functions for working with tuples. Some of these functions are available in the Control.Arrow module, but here are available specialised to pairs.

Synopsis

Specialised Arrow functions

first :: (a -> a') -> (a, b) -> (a', b)Source

Update the first component of a pair.

second :: (b -> b') -> (a, b) -> (a, b')Source

Update the second component of a pair.

(***) :: (a -> a') -> (b -> b') -> (a, b) -> (a', b')Source

(&&&) :: (a -> b) -> (a -> c) -> a -> (b, c)Source

More pair operations

dupe :: a -> (a, a)Source

both :: (a -> b) -> (a, a) -> (b, b)Source

Operations on triples

fst3 :: (a, b, c) -> aSource

snd3 :: (a, b, c) -> bSource

thd3 :: (a, b, c) -> cSource

first3 :: (a -> a') -> (a, b, c) -> (a', b, c)Source

Update the first component of a triple.

second3 :: (b -> b') -> (a, b, c) -> (a, b', c)Source

Update the second component of a triple.

third3 :: (c -> c') -> (a, b, c) -> (a, b, c')Source

Update the third component of a triple.

dupe3 :: a -> (a, a, a)Source

both3 :: (a -> b) -> (a, a, a) -> (b, b, b)Source