
Ok, that works. On to code reading and, hopefully, enlightenment.
Thanks, all.
Michael
--- On Sun, 12/26/10, Daniel Fischer
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