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

Ross Paterson ross at soi.city.ac.uk
Tue Mar 6 13:08:02 EST 2007


On Mon, Mar 05, 2007 at 02:11:58PM -0800, Jeffrey Yasskin wrote:
> On 3/4/07, David Menendez <zednenem at psualum.com> wrote:
> >Rather than have two wrappers, I say make the a Monoid instance for
> >Maybe using a left-biased choice (like the MonadPlus instance).
> >
> >Then we would get right-biased choice for free with the Dual wrapper.
> 
> That's a reasonable idea, but I chose against it in the proposal
> because it arbitrarily picks one of the two sensible monoids for
> Maybe, which I'm worried will confuse users, especially since Haddock
> doesn't currently provide documentation for instances.

There is another, combining two Justs using a Monoid instance on the
argument.  It could be argued that this is an even better candidate
for the "obvious" instance on Maybe.



More information about the Libraries mailing list