:: (a -> m (Maybe b)) -> [a] -> m [b] -package:extra

Applicative version of mapMaybe
The monadic version of the mapMaybe function.
>>> :{
evenInHalf :: Int -> IO (Maybe Int)
evenInHalf n
| even n = pure $ Just $ n `div` 2
| otherwise = pure Nothing
:}
>>> mapMaybeM evenInHalf [1..10]
[1,2,3,4,5]
Monadic mapMaybe.
A monadic version of mapMaybe :: (a -> Maybe b) -> [a] -> [b].
A version of mapMaybe that works with a monadic predicate.
Applicative mapMaybe.
Map each element to a Maybe monoidal and sequence the results (like traverse and mapMaybe).
A monadic version of mapMaybe :: (a -> Maybe b) -> [a] -> [b].
The for version of mapMaybeM.