
4 Sep
2007
4 Sep
'07
11:35 p.m.
I've been thinking about making a data type an instance of MonadPlus. From the Haddock documentation at haskell.org, I see that any such instance should satisfy mzero `mplus` x = x x `mplus` mzero = x mzero >>= f = mzero v >> mzero = mzero but is that all there is to it? Are there no other requirements for MonadPlus to make sense? I also wondered why, once MonadPlus was added to the language, the definition of ++ wasn't changed to (++) = MonadPlus (with the MonadPlus instance for [] defined directly). Aside from getting msum and guard, is there any point in bothering to make something an instance of MonadPlus?