[Haskell-cafe] Intro to monad transformers
nowgate at yahoo.com
Sun Dec 26 22:27:38 CET 2010
Ok, that works. On to code reading and, hopefully, enlightenment.
--- On Sun, 12/26/10, Daniel Fischer <daniel.is.fischer at googlemail.com> wrote:
From: Daniel Fischer <daniel.is.fischer at googlemail.com>
Subject: Re: [Haskell-cafe] Intro to monad transformers
To: haskell-cafe at haskell.org
Cc: "michael rice" <nowgate at yahoo.com>, "David Menendez" <dave at zednenem.com>
Date: Sunday, December 26, 2010, 4:07 PM
On Sunday 26 December 2010 21:21:00, michael rice wrote:
> Ok, changed the last line and deleted the bad line. Maybe someone could
> recommend a better example?
> Prelude> :l test5
> [1 of 1] Compiling Main ( test5.hs, interpreted )
> Occurs check: cannot construct the infinite type: a = Maybe a
> When generalising the type(s) for `mplus'
> In the instance declaration for `MonadPlus (MaybeT m)'
> Failed, modules loaded: none.
> mplus x y = MaybeT $ do maybe_value <- runMaybeT x
> case maybe_value
> Nothing -> runMaybeT y
> Just value -> runMaybeT x
> The last line is wrong. It should be, "Just value -> return value".
Actually, it should be
case maybe_value of
Nothing -> runMaybeT y
_ -> return maybe_value
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe