mapM -transformers

mapM :: Monad m => (a -> m b) -> [a] -> m [b]
base Prelude, base Control.Monad
mapM f is equivalent to sequence . map f.
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
base Data.Traversable
mapM_ :: Monad m => (a -> m b) -> [a] -> m ()
base Prelude, base Control.Monad
mapM_ f is equivalent to sequence_ . map f.
mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
base Data.Foldable
Map each element of a structure to a monadic action, evaluate these actions from left to right, and ignore the results.
mapMaybe :: (a -> Maybe b) -> [a] -> [b]
base Data.Maybe
The mapMaybe function is a version of map which can throw out elements. In particular, the functional argument returns something of type Maybe b. If this is Nothing, no element is added on to the result list. If it just Just b, then b is included in the result list.
mapMaybe :: (a -> Maybe b) -> IntMap a -> IntMap b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Map values and collect the Just results. > let f x = if x == "a" then Just "new a" else Nothing > mapMaybe f (fromList [(5,"a"), (3,"b")]) == singleton 5 "new a"
mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). Map values and collect the Just results. > let f x = if x == "a" then Just "new a" else Nothing > mapMaybe f (fromList [(5,"a"), (3,"b")]) == singleton 5 "new a"
mapMaybeWithKey :: (Key -> a -> Maybe b) -> IntMap a -> IntMap b
containers Data.IntMap.Strict, containers Data.IntMap.Lazy
O(n). Map keys/values and collect the Just results. > let f k _ = if k < 5 then Just ("key (:) " ++ (show k)) else Nothing > mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key (:) 3"
mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b
containers Data.Map.Lazy, containers Data.Map.Strict
O(n). Map keys/values and collect the Just results. > let f k _ = if k < 5 then Just ("key (:) " ++ (show k)) else Nothing > mapMaybeWithKey f (fromList [(5,"a"), (3,"b")]) == singleton 3 "key (:) 3"
mapMonotonic :: (a -> b) -> Set a -> Set b
containers Data.Set
O(n). The mapMonotonic f s == map f s, but works only when f is monotonic. The precondition is not checked. Semi-formally, we have: > and [x < y ==> f x < f y | x <- ls, y <- ls] > ==> mapMonotonic f s == map f s >  
gmapM :: (Data a, Monad m) => (forall d. Data d => d -> m d) -> a -> m a
base Data.Data
gmapMo :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a
base Data.Data
gmapMp :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a
base Data.Data
package enummapmap
package
This package provides 'maps of maps' using Enum types as keys. The code is based upon Data.IntMap in containers 5.0. Version 0.5.0
type NodeMapM a b g r = State (NodeMap a, g a b) r
fgl Data.Graph.Inductive.NodeMap
Graph construction monad; handles passing both the NodeMap and the Graph.