utility-ht-0.0.10: Various small helper functions for Lists, Maybes, Tuples, Functions

Safe HaskellSafe-Inferred
LanguageHaskell98

Data.Tuple.HT

Contents

Synopsis

Pair

mapPair :: (a -> c, b -> d) -> (a, b) -> (c, d) Source

Cf. '(Control.Arrow.***)'.

Apply two functions on corresponding values in a pair, where the pattern match on the pair constructor is lazy. This is crucial in recursions such as the of partition.

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

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

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

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

Triple

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

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

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

mapTriple :: (a -> d, b -> e, c -> f) -> (a, b, c) -> (d, e, f) Source

mapFst3 :: (a -> d) -> (a, b, c) -> (d, b, c) Source

mapSnd3 :: (b -> d) -> (a, b, c) -> (a, d, c) Source

mapThd3 :: (c -> d) -> (a, b, c) -> (a, b, d) Source

curry3 :: ((a, b, c) -> d) -> a -> b -> c -> d Source

uncurry3 :: (a -> b -> c -> d) -> (a, b, c) -> d Source