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
|
The last line is wrong. It should be, "Just value -> return value". But that doesn't cause the problem.
instance Show (MaybeT m a)
|
This is never valid. You've defined show, shows, and showsPrec in terms of each other, creating unbounded recursion. Delete it.
*Main> askPassword Loading package transformers-0.2.2.0 ... linking ... done. *** Exception: stack overflow
|
This triggers the unbounded recursion, when it tries to show askPassword. Note that there is no way to show IO values, so there's no way to show MaybeT IO values.
Instead, use runMaybeT askPassword