
15 Sep
2009
15 Sep
'09
8:21 p.m.
On Tue, Sep 15, 2009 at 3:08 AM, Brent Yorgey
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-Mon...), 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