
9 May
2008
9 May
'08
8:12 p.m.
Andrew Coppin wrote:
...so it's a kind of choice operator? Run all actions until you get to one that succeeds and return the result from that?
In the context of Parsec, yes. In the grander scheme of things, the behaviour depends on whatever is appropriate for the particular monad you're working in. So, for example, mplus for lists is (++) and mzero is [], which is quite a different set of behaviours from the Parsec case. Usually, you can rely on MonadPlus behaving like a monoid. There are occasional exceptions, which is a mite upsetting. http://www.haskell.org/haskellwiki/MonadPlus