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

Joachim Breitner mail at joachim-breitner.de
Sat Feb 21 21:48:48 UTC 2015


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150221/0a6ebedc/attachment.sig>


More information about the Libraries mailing list