> instance Monad m => MonadPlus (MaybeT m) where
>     mzero     = MaybeT $ return Nothing
>     mplus x y = MaybeT $ do maybe_value <- runMaybeT x
>                             case maybe_value of
>                                  Nothing    -> runMaybeT y
>                                  Just _ -> return maybe_value
>

I've not run it so with some caution, I'd expect this to work - the
last line is now returning the first answer with 'return' of the
wrapped monad.

I'm not sure if this is a lawful version of mplus though...

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to