On Sep 15, 2009, at 16:21 , Michael Snoyman wrote:
On Tue, Sep 15, 2009 at 3:08 AM, Brent Yorgey <byorgey@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.

That's a bit of stupidity I wish would be fixed; for some bizarre reason, the instance is in Control.Monad.Error.

-- 
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery@kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery@ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH