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

David Menendez zednenem at psualum.com
Mon Mar 5 00:08:43 EST 2007


Jeffrey Yasskin writes:

> I've created http://hackage.haskell.org/trac/ghc/ticket/1189 to
> suggest adding two Monoid instances around Maybe that, instead of
> accumulating things like most monoids, just pick the first or last
> piece of data they see.

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.
-- 
David Menendez <zednenem at psualum.com> | "In this house, we obey the laws
<http://www.eyrie.org/~zednenem>      |        of thermodynamics!"


More information about the Libraries mailing list