traverse -package:base-compat -package:case-insensitive package:rio

Map each element of a structure to an action, evaluate these actions from left to right, and collect the results. For a version that ignores the results see traverse_.
Perform an Applicative action for each key-value pair in a HashMap and produce a HashMap of all the results. Each HashMap will be strict in all its values.
traverseWithKey f = fmap (map id) . Data.HashMap.Lazy.traverseWithKey f
Note: the order in which the actions occur is unspecified. In particular, when the map contains hash collisions, the order in which the actions associated with the keys involved will depend in an unspecified way on their insertion order.
traversed traverses any Traversable container (list, vector, Map, Maybe, you name it):
>>> Just 1 ^.. traversed
[1]
traversed is the same as traverse, but can be faster thanks to magic rewrite rules.
O(n). Traverse keys/values and collect the Just results.
O(n). traverseWithKey f m == fromList $ traverse ((k, v) -> (v' -> v' `seq` (k,v')) $ f k v) (toList m) That is, it behaves much like a regular traverse except that the traversing function also has access to the key associated with a value and the values are forced before they are installed in the result map.
traverseWithKey (\k v -> if odd k then Just (succ v) else Nothing) (fromList [(1, 'a'), (5, 'e')]) == Just (fromList [(1, 'b'), (5, 'f')])
traverseWithKey (\k v -> if odd k then Just (succ v) else Nothing) (fromList [(2, 'c')])           == Nothing
Map each element of a structure to an action, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results see traverse.
traverseWithIndex is a version of traverse that also offers access to the index of each element.
Evaluates the relevant functions at each element in the structure, running the action, and builds a new structure with the same shape, using the results produced from sequencing the actions.
bitraverse f g ≡ bisequenceA . bimap f g
For a version that ignores the results, see bitraverse_.
Map each element of a structure using one of two actions, evaluate these actions from left to right, and ignore the results. For a version that doesn't ignore the results, see bitraverse.