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

Yitzchak Gale gale at sefer.org
Sun May 25 09:37:12 EDT 2008

I wrote:
>> 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.

Neil Mitchell wrote:
> mzero vs. Nothing
> One doesn't crash, the other may crash depending on what is floating
> around. Perhaps I've used type inference extensively, and the actual
> decision of what mzero means is 10 functions away. Now its really
> hard to see the program is safe, versus not.

Why is that any different than than the risk of Nothing when
there may be an incomplete pattern match on Just that
is 10 functions away?

Functions, methods, and constructors each have their
own associated risks. Aren't those risks orthogonal to
which type we choose?

>> 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?

> Discussions about the ideal and perfect API should not come down to
> such minor considerations as efficiency :-)  In reality, I don't think
> it makes any difference, and in fact I think the Monad class might
> make some things more efficient,

Well then, it's back to deuce, as far as I'm concerned.

Which is bad, because in the meantime we're still stuck
with fail.


More information about the Libraries mailing list