[Haskell-cafe] Intro to monad transformers
michael rice
nowgate at yahoo.com
Sun Dec 26 22:27:38 CET 2010
Ok, that works. On to code reading and, hopefully, enlightenment.
Thanks, all.
Michael
--- 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?
>
> Michael
>
> =============
>
> Prelude> :l test5
> [1 of 1] Compiling Main ( test5.hs, interpreted )
>
> test5.hs:16:4:
> 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
> of
> 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...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20101226/10ea5b99/attachment.htm>
More information about the Haskell-Cafe
mailing list