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

Edward Kmett ekmett at gmail.com
Sun Feb 22 08:25:02 UTC 2015


I generally feel having these only-one-way-to-do-it instances just defined
is better than forcing orphans upon those who _do_ want them.

Inevitably those users seem to wind up with separate orphans that tend to
collide, or just give up and define their own type. Both of those outcomes
are rather suboptimal.

-Edward

On Sat, Feb 21, 2015 at 4:48 PM, 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/20150222/90170e9a/attachment.html>


More information about the Libraries mailing list