
I can't get searchAll5[1] in Yet Another Haskell Tutorial to run. Ghci complains that it can't find a MonadPlus that satisfies the required type; it needs a MonadPlus. I suspect this is due to the use of 'mzero' and 'mplus', without making StateT a MonadPlus. My thought for this was to "push" mzero into the inner monad and have 'mplus' pass on to the inner monad: instance Monad m => MonadPlus (StateT state m) where mzero = StateT (\s -> return (s, mzero)) (StateT m1) `mplus` (StateT m2) = StateT (\s -> do (s1, a) <- m1 s (s2, b) <- m2 s1 return (s2, a `mplus` b)) What's above isn't accepted by ghci, and I don't even know for sure that my thought makes sense. /M [1]: http://en.wikibooks.org/wiki/Haskell/YAHT/Monads#Monad_Transformers -- Magnus Therning (OpenPGP: 0xAB4DFBA4) magnus@therning.org Jabber: magnus.therning@gmail.com http://therning.org/magnus Software is not manufactured, it is something you write and publish. Keep Europe free from software patents, we do not want censorship by patent law on written works. Finagle's Fifth Law: Always draw your curves, then plot your readings.