Skip to content

Feature request: Data.Foldable.asumMap

I'd like to request that an asumMap function be added to Data.Foldable, which would be a generalization of concatMap in the same way that asum is a generalization of concat. Its proposed definition:

asumMap :: (Foldable t, Alternative f) => (a -> f b) -> t a -> f b
asumMap f = foldr ((<|>) . f) empty

This is almost equivalent to a combination of asum and fmap, but it doesn't require a Functor t constraint like that does.

Notes on its usefulness:

Edited by Joseph C. Sible
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information