Proposal: Add the orphan instance Monoid e => Monad ((, )e) to Data.Monoid

Bas van Dijk v.dijk.bas at gmail.com
Sun Nov 13 01:48:58 CET 2011


On 12 November 2011 21:29, Edward Kmett <ekmett at gmail.com> wrote:
> I propose adding an (orphan) instance of Monad for ((,) e) to Data.Monoid.

We could make it non-orphaned by putting it in GHC.Base. This does
require putting the Monoid type class together with the [a], (a->b),
(), (a,b), (a,b,c), (a,b,c,d) and (a,b,c,d,e) Monoid instances in
GHC.Base. Data.Monoid then just re-exports the type class and
instances.

I'm +1 either way.

BTW, it would be really nice if transformers could change its WriterT type from:

newtype WriterT w m a = WriterT { runWriterT :: m (a, w) }

to:

newtype WriterT w m a = WriterT { runWriterT :: m (w, a) }

so that it becomes compatible with the proposed ((,) w) instance.

Ross, any chance that this could be done. Or does this break to much code?

Cheers,

Bas



More information about the Libraries mailing list