#2309: containers: specialize functions that fail in a Monad to Maybe

Yitzchak Gale gale at sefer.org
Sun May 25 08:14:27 EDT 2008

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

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.


More information about the Libraries mailing list