[Haskell-cafe] MonadPlus
Andrew Coppin
andrewcoppin at btinternet.com
Fri May 9 15:39:38 EDT 2008
OK, so I feel I understand monads fine. I regularly use Maybe, [] and
IO, and I've even constructed a few monads of my own. But here's a
question: what is the purpose of the MonadPlus class?
Clearly it defines a binary operation over monadic values and an
identity element for that operation. But... what is this supposed to
*do*? (For example, (>>) has an almost identical signature to mplus. But
presumably they don't both do the same thing...) What functionallity is
this supposed to give you?
[In a somewhat unrelated question... I saw some code the other day that
used Either as if it were a monad. And yet, I don't see an instance
given in the standard libraries - even though there should be one. I can
see Functor (Either a), but not Monad (Either a) or even Monad (Either
String)...]
More information about the Haskell-Cafe
mailing list