[Haskell-cafe] foldMap for semigroups
oleg.grenrus at iki.fi
Fri May 14 20:13:10 UTC 2021
Is there a good reason why it does not have:
A good question. See
- (2017) https://gitlab.haskell.org/ghc/ghc/-/issues/13573
- (2021) https://twitter.com/kmett/status/1363774888603914242
For recent bits and bobs of the possible answers.
On 14.5.2021 22.54, coot at 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.
> Best regards,
> Marcin Szamotulski
> Sent with ProtonMail Secure Email.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe