
Ross Paterson wrote:
I'm not sure whether those arguing for MonadPlus are suggesting that these functions should use fail or mzero to signal failure. If fail, there will be instances that implement it using error or an exception.
Oh, no, they must mean mzero. I thought that was the whole point.
If mzero, there's less gained over Maybe, but still no guarantee of safety.
If a program has a safety problem with mzero, that anyway needs to be detected. So I don't think that will have an effect on overall program safety, it's an orthogonal safety concern. Other than minor convenience adavantages one way or the other depending on what program I happen to be writing, there is only one thing I can think of that might make a difference. Current compilers might produce programs that are slightly less efficient with MonadPlus, and there might be no easy way to work around that if MonadPlus is hard-wired into the library. Efficiency experts? For me, even if that is true, it would rarely be an issue. -Yitz