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

Safe Haskell | Safe
Language | Haskell98

Control.Functor.HT

Synopsis

- void :: Functor f => f a -> f ()
- map :: Functor f => (a -> b) -> f a -> f b
- for :: Functor f => f a -> (a -> b) -> f b
- unzip :: Functor f => f (a, b) -> (f a, f b)
- unzip3 :: Functor f => f (a, b, c) -> (f a, f b, f c)
- mapFst :: Functor f => (a -> f c) -> (a, b) -> f (c, b)
- mapSnd :: Functor f => (b -> f c) -> (a, b) -> f (a, c)
- mapFst3 :: Functor f => (a -> f d) -> (a, b, c) -> f (d, b, c)
- mapSnd3 :: Functor f => (b -> f d) -> (a, b, c) -> f (a, d, c)
- mapThd3 :: Functor f => (c -> f d) -> (a, b, c) -> f (a, b, d)
- outerProduct :: (Functor f, Functor g) => (a -> b -> c) -> f a -> g b -> f (g c)

# Documentation

void :: Functor f => f a -> f () #

map :: Functor f => (a -> b) -> f a -> f b #

for :: Functor f => f a -> (a -> b) -> f b #

unzip :: Functor f => f (a, b) -> (f a, f b) #

Caution: Every pair member has a reference to the argument of `unzip`. Depending on the consumption pattern this may cause a memory leak. For lists, I think, you should generally prefer `unzip`.

unzip3 :: Functor f => f (a, b, c) -> (f a, f b, f c) #

Caution: See `unzip`.

mapFst :: Functor f => (a -> f c) -> (a, b) -> f (c, b) #

mapSnd :: Functor f => (b -> f c) -> (a, b) -> f (a, c) #

mapFst3 :: Functor f => (a -> f d) -> (a, b, c) -> f (d, b, c) #

mapSnd3 :: Functor f => (b -> f d) -> (a, b, c) -> f (a, d, c) #

mapThd3 :: Functor f => (c -> f d) -> (a, b, c) -> f (a, b, d) #

outerProduct :: (Functor f, Functor g) => (a -> b -> c) -> f a -> g b -> f (g c) #

Generalization of `outerProduct`.