
14 May
2021
14 May
'21
9:11 p.m.
On Fri, 14 May 2021, coot@coot.me wrote:
Base has: * foldMap :: (Foldable t, Monoid a) => (x -> a) -> t x -> a * foldr1 :: (Foldable t) => (a -> a -> a) -> t x -> a Is there a good reason why it does not have: ``` foldMap1 :: (Foldable t, Semigroup a, Functor f) => (a -> a) -> t x -> a foldMap1 = fodlr1 (<>) . fmap f ``` Like `foldr1` it is partial for any foldable that can be empty.
I do not think we should extend support for partial functions. foldMap1 should be restricted to non-empty Foldable (i.e. Foldable1).