[Haskell-beginners] Maybe, Either

Michael Snoyman michael at snoyman.com
Tue Sep 15 16:21:46 EDT 2009


On Tue, Sep 15, 2009 at 3:08 AM, Brent Yorgey <byorgey at seas.upenn.edu>wrote:

>
> It doesn't work in *all* monads -- it only works in monads which
> support a sensible notion of failure.  This is exactly what is
> captured by the MonadPlus constraint on my version of mLookup.  And,
> in fact, any monad in context of which you would want to use mLookup
> (IO, Maybe, [], ...) are already instances of MonadPlus.
>

I'm looking at the Control.Monad documentation (
http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad.html),
and it doesn't seem that IO is an instance of MonadPlus. I get the same
results with a simple code check. Can you clarify? Calling lookup from IO is
a common use case for me.

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090915/5d6be542/attachment.html


More information about the Beginners mailing list