map :: Ord k => ((k, a) -> Gen r -> Gen r) -> Map k a -> Gen r -> Gen r
map :: Ord k => ((k, a) -> [(k, a)]) -> Map k a -> [Map k a]
implementations for common types | Hackage
whether module and package imports conform to the PVP | Hackage
operations for finite maps using Data.Map | Hackage

lens - Data.Map.Lens  

One of most commonly-asked questions about this package is whether it provides lenses for working with Map. It does, but their uses are perhaps obscured by their genericity. This module exists to provide documentation for them.

Map is an instance of At, so we have a lenses on values at keys:

>>> Map.fromList [(1, "world")] ^.at 1
Just "world"
>>> at 1 .~ Just "world" $ Map.empty
fromList [(1,"world")]
>>> at 0 ?~ "hello" $ Map.empty
fromList [(0,"hello")]

We can traverse, fold over, and map over key-value pairs in a Map, thanks to its TraversableWithIndex, FoldableWithIndex, and FunctorWithIndex instances.

>>> imap const $ Map.fromList [(1, "Venus")]
fromList [(1,1)]
>>> ifoldMap (\i _ -> Sum i) $ Map.fromList [(2, "Earth"), (3, "Mars")]
Sum {getSum = 5}
>>> itraverse_ (curry print) $ Map.fromList [(4, "Jupiter")]
>>> itoList $ Map.fromList [(5, "Saturn")]

A related class, Ixed, allows us to use ix to traverse a value at a particular key.

>>> ix 2 %~ ("New " ++) $ Map.fromList [(2, "Earth")]
fromList [(2,"New Earth")]
>>> preview (ix 8) $ Map.empty

Additionally, Map has TraverseMin and TraverseMax instances, which let us traverse over the value at the least and greatest keys, respectively.

>>> preview traverseMin $ Map.fromList [(5, "Saturn"), (6, "Uranus")]
Just "Saturn"
>>> preview traverseMax $ Map.fromList [(5, "Saturn"), (6, "Uranus")]
Just "Uranus"
map :: Nat -> (Nat -> LocalId -> Exp) -> Exp -> Exp
map :: (Ord a, Ord b) => (a -> b) -> Bag a -> Bag b

AvlTree - Data.Tree.AVL  

Apply a function to every element in an AVL tree. This function preserves the tree shape. There is also a strict version of this function (map').

N.B. If the tree is sorted the result of this operation will only be sorted if the applied function preserves ordering (for some suitable ordering definition).

Complexity: O(n)

map :: (a -> b) -> f a -> f b Class Method
map :: (Word8 -> Word8) -> Rope -> Rope

Data-Rope - Data.Rope  

O(n). map f r applies f on each element of r and returns the concatenation of the result.

map :: AssocX m k => (a -> b) -> m a -> m b

EdisonAPI - Data.Edison.Assoc  

Apply a function to the elements of every binding in the associative collection. Identical to fmap from Functor.

This function is always unambiguous.

map :: (Coll cin a, CollX cout b) => (a -> b) -> cin -> cout

EdisonAPI - Data.Edison.Coll.Utils  

Apply a function across all the elements in a collection and transform the collection type.

map :: Sequence s => (a -> b) -> s a -> s b

EdisonAPI - Data.Edison.Seq  

Return the result of applying a function to every element of a sequence. Identical to fmap from Functor.

 map f  = 


  • map f empty = empty
  • map f (lcons x xs) = lcons (f x) (map f xs)

This function is always unambiguous.

Default running time: O( t * n ) where t is the running time of f

map :: (Ord k, Functor (FM k)) => (a -> b) -> FM k a -> FM k b