
Am Samstag, 22. Januar 2005 21:20 schrieb Keean Schupke:
Ashley Yakeley wrote:
In article <41F211FB.3030706@imperial.ac.uk>,
Keean Schupke
wrote: This fits the above description, but I don't see how the following can be true:
(mplus a b) >>= c = mplus (a >>= c) (b >>= c)
Try it (and my test code) with [], which is an instance of MonadPlus. mplus is defined as (++) for [].
but what if (a >>= c) causes c to fail, and (b >>= c) lets c succeed. In this case the LHS will fail, whereas the RHS will succeed I think?
Keean.
That's probably a misunderstanding due to the notation, in the [] monad, it's just concat (map c (a ++ b)) = concat (map c a) ++ concat (Map c b), which is easily seen to be true (if applying c to an element of a causes an error, neither side will go past that). Daniel