#2309: containers: specialize functions that fail in a Monad
ross at soi.city.ac.uk
Sun May 25 09:36:43 EDT 2008
On Sun, May 25, 2008 at 02:26:36AM +0200, Twan van Laarhoven wrote:
> Ross Paterson wrote:
>> The proposal is to change these signatures back, specializing them
>> to Maybe.
> To retain most of the convenience I would propose we use MonadPlus
> instead, which is arguably where fail should have been put in the first
> place (*).
> (*) Actually in a superclass MonadZero, but let's work with what we have now.
Also, for a map to be empty or not contain a particular key is not
intrinsically an error; in particular the view functions are just views.
If one wants to treat these cases as errors, it seems reasonable to mark
More information about the Libraries