[Haskell-cafe] foldMap for semigroups
coot at coot.me
coot at coot.me
Fri May 14 19:54:46 UTC 2021
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.
Best regards,
Marcin Szamotulski
Sent with ProtonMail Secure Email.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 509 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20210514/2d0f4d7e/attachment.sig>
More information about the Haskell-Cafe
mailing list