# (a -> b) -> m a -> m b

This function may be used as a value for fmap in a Functor instance.
An infix synonym for fmap.
Lift a function to actions. This function may be used as a value for fmap in a Functor instance.
Promote a function to a monad.

*O(n)*. Map a function over all values in the map.
> map (++ "x") (fromList [(5,"a"), (3,"b")]) == fromList [(3, "bx"), (5, "ax")]

*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
>
map f xs is the list obtained by applying f to each element of xs, i.e.,
> map f [x1, x2, ..., xn] == [f x1, f x2, ..., f xn]
> map f [x1, x2, ...] == [f x1, f x2, ...]
In many situations, the liftM operations can be replaced by uses of ap, which promotes function application.
> return f `ap` x1 `ap` ... `ap` xn
is equivalent to
> liftMn f x1 x2 ... xn
A variant of <*> with the arguments reversed.
*O(n*log n)*. map f s is the set obtained by applying f to each element of s.
It's worth noting that the size of the result may be smaller if, for some (x,y), x /= y && f x == f y
A combination of parList and map, encapsulating a common pattern:
> parMap strat f = withStrategy (parList strat) . map f
Application operator. This operator is redundant, since ordinary application (f x) means the same as (f $ x). However, $ has low, right-associative binding precedence, so it sometimes allows parentheses to be omitted; for example:
> f $ g $ h x = f (g (h x))
It is also useful in higher-order situations, such as map ($ 0) xs, or Data.List.zipWith ($) fs xs.
Strict (call-by-value) application, defined in terms of seq.
*O(log(min(i,n-i)))*. Update the element at the specified position. If the position is out of range, the original sequence is returned.

This function may be used as a value for Data.Foldable.foldMap in a Foldable instance.
*O(min(n,W))*. Adjust a value at a specific key. When the key is not a member of the map, the original map is returned.
> adjust ("new " ++) 5 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "new a")]
> adjust ("new " ++) 7 (fromList [(5,"a"), (3,"b")]) == fromList [(3, "b"), (5, "a")]
> adjust ("new " ++) 7 empty == empty

The maybe function takes a default value, a function, and a Maybe value. If the Maybe value is Nothing, the function returns the default value. Otherwise, it applies the function to the value inside the Just and returns the result.
Show more results