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

Yitzchak Gale gale at sefer.org
Sun May 25 06:34:49 EDT 2008

I personally would be happy with either Maybe or MonadPlus.

I hope we don't miss out on getting rid of fail by arguing
about Maybe vs. MonadPlus.

Dan Doel wrote:
> I don't see how specializing to Maybe and requiring people to explicitly
> inject into an arbitrary MonadPlus gains anything over restricting to
> MonadPlus in the first place.

Maybe is not arbitrary. It is the "unit" instance of MonadPlus. It can be
lifted trivially into any other instance.

Krasimir Angelov wrote:
> I think the proposal to generalize to MonadPlus is even worse. In this
> case the function can indicate failure with either fail or mzero which
> makes things even worse.

The same is true for Maybe. But once we are in Maybe or MonadPlus,
fail becomes a red herring. Any program that uses fail can be marked
as unsafe, just like any program that uses error.


More information about the Libraries mailing list