Proposal: Add First and Last wrappers around Maybe to Data.Monoid

Jeffrey Yasskin jyasskin at
Tue Mar 13 01:22:22 EDT 2007

A MonadPlus instance and a Monoid instance will be used in different
circumstances, so I don't see a compelling argument that they should
always be the same if both exist for a particular type. Maybe you have
one? Note that [] and the nearly identical Seq are the only types so
far to have both instances, so there's no particular reason to think
we can generalize from them.

MonadPlus Maybe and Monoid First are the same though.

If people want, and can provide a name for the type, I'm willing to
wrap the "inject identity" instance in the same way First and Last are
wrapped. But if nobody besides you speaks up in the next day or two,
I'll assume it's not a widespread complaint and go with what I have.

Thanks for the comment though,

On 3/12/07, Spencer Janssen <sjanssen at> wrote:
> I'd like to note that the behavior for this Maybe instance is quite
> different from what you get with MonadPlus.  This seems inconsistent
> with respect to the instances of MonadPlus and Monoid for lists.
> I realize I'm objecting in the 11th hour, but I think this requires
> some consideration.
> Cheers,
> Spencer Janssen
> On Mon, 12 Mar 2007 08:10:24 -0800
> "Jeffrey Yasskin" <jyasskin at> wrote:
> > Today is the scheduled end for discussion on this proposal. Are there
> > any final objections, suggestions, or comments before I update the
> > ticket and ask someone to commit it?
> >
> > On 3/8/07, Jeffrey Yasskin <jyasskin at> wrote:
> > > I've attached a second version of the patch to the ticket
> > > ( along with the
> > > HTML Haddock generates from it. I added the two examples and the
> > > "imposed identity" instance directly on Maybe. Would one of its
> > > fans like to provide an example of using the Maybe monoid?

More information about the Libraries mailing list