Hm. I hadn't considered the liftM2 version. It would need Monoid a instead of Monoid r, and it would behave differently. The version I suggested is motivated by a library for a Fran-like functional event-based programming that I'm preparing to release, based on Cont. In the monoid def I gave corresponds, mempty is the never-occurring event, and mappend is a sort of union of two events. I sure don't know how to resolve these situations of more than one credible instance. I'm seeing more & more of them. Thanks for the pointer on library submissions. I'm with you about liftM0 (and liftA0). Cheers, - Conal On 9/8/07, Stefan O'Rear <stefanor@cox.net> wrote:
On Sat, Sep 08, 2007 at 05:26:09PM -0700, Conal Elliott wrote:
I'd like to see the following addition to Control.Monad.Cont in mtl:
instance Monoid r => Monoid (Cont r a) where mempty = Cont mempty m `mappend` m' = Cont (runCont m `mappend` runCont m')
What's the process for suggesting, discussing, and making such changes?
http://haskell.org/haskellwiki/Library_submissions
(My 2 cents: Why not mempty = return mempty; mappend = liftM2 mappend ? Instances are best if unambiguous.)
(Why is there no liftM0 ?)
Stefan
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFG40G1FBz7OZ2P+dIRAiIgAJ0bhthqmBvcpoqLnNF+RcbccUBKYACeO4QO sJ9sUvnkvkfZsgIBbgq6r9U= =cCFe -----END PGP SIGNATURE-----