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

Joachim Breitner mail at
Sat Feb 21 18:21:59 UTC 2015


Am Samstag, den 21.02.2015, 17:34 +0200 schrieb Oleg Grenrus:
> I propose to add Functor, Applicative, Monad, Foldable, and
> Traversable and maybe even MonadFix instances to wrapper newtypes in
> the Data.Monoid module.

can you explain when these are useful? 

Especially, the Monad instance might be rather confusing: When I see
"Monad Sum", I might somehow expect that >>= would somehow, well, sum
things up. But

  foo = getSum $ do
     return 1
     return 2
     return 3
     return 4

does not return 10

(At least you are not proposing a MonadPlus instance; that would be then
really confusing.)



Joachim “nomeata” Breitner
  mail at joachim-breitner.de
  Jabber: nomeata at  • GPG-Key: 0xF0FBF51F
  Debian Developer: nomeata at

-------------- 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: <>

More information about the Libraries mailing list