Proposal: Functor and friends for the wrappers in Data.Monoid

Oliver Charles ollie at ocharles.org.uk
Sat Feb 21 22:22:06 UTC 2015


My point was that foldMap pure would happen somewhere entirely different -
maybe in a library outside my control. Obviously that one line example
doesn't quite communicate that though. If Sum is applicative, then I have
the ability to just apply getSum, and have the Sum constructor
automatically chosen for me.
On 21 Feb 2015 21:48, "Joachim Breitner" <mail at joachim-breitner.de> wrote:

> HI,
>
> Am Samstag, den 21.02.2015, 21:26 +0000 schrieb Oliver Charles:
> > Having Applicative might be nice for `pure`. That way we can getSum .
> > foldMap pure, and so on. Of course, in that case using `Sum` is no
> > different, but this opens up the ability to construct `Sum`s from
> > other parts of code that simply require `Applicative`.
>
> is that any better than "getSum . foldMap Sum"?
>
> Adding an Applicative instance, when the only main use case is to
> cover-over the lack of a Pointed type class, does not seem to be a good
> guiding principle.
>
> BTW, coerce would work as well here, if you for some reason want to use
> a polymorphic argument to foldMap.
>
> Still not convinced :-),
> Joachim
>
>
> --
> Joachim “nomeata” Breitner
>   mail at joachim-breitner.dehttp://www.joachim-breitner.de/
>   Jabber: nomeata at joachim-breitner.de  • GPG-Key: 0xF0FBF51F
>   Debian Developer: nomeata at debian.org
>
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150221/07e32195/attachment.html>


More information about the Libraries mailing list