[Haskell-cafe] Intro to monad transformers
Stephen Tetley
stephen.tetley at gmail.com
Sun Dec 26 20:17:21 CET 2010
On 26 December 2010 19:00, michael rice <nowgate at yahoo.com> wrote:
>
> I lifted the code below from here:
>
> http://en.wikibooks.org/wiki/Haskell/Monad_transformers
>
> Since the wiki page doesn't say what needs to be imported, I'm guessing.
>
> Not sure what is happening. Maybe someone can tell me.
> 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 value -> runMaybeT x
>
I haven't run the code but the definition of mplus here looks cyclic.
More information about the Haskell-Cafe
mailing list