I often use expressions of the form maybe (return ()) someFunc someMaybe
.
Searching for a function Monad m => (a -> m ()) -> Maybe a -> m ()
on hoogle doesn't yield a specific result. Isn't there any library function for this?
You can use mapM_
or forM_
from Data.Foldable for this. See also the recent discussion on the librariers mailing list.