
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"
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@joachim-breitner.de • http://www.joachim-breitner.de/ Jabber: nomeata@joachim-breitner.de • GPG-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org
_______________________________________________ Libraries mailing list Libraries@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries