[Haskell-cafe] Why Maybe exists if there is Either?

Brandon Allbery allbery.b at gmail.com
Thu Jan 9 17:15:02 UTC 2014


On Thu, Jan 9, 2014 at 10:36 AM, Vlatko Basic <vlatko.basic at gmail.com>wrote:

> > If you just want to signalize a fail case without any additional
> > information, then a Maybe fits better than an Either, because
> > why should you need this bogus empty string?
>
> Now it looks to me that it might be better and more consistent to write an
> empty bogus string (as with: nothing = Left "") than to have two distinct
> ways of error reporting, and both are used widely and often should be
> intermixed.
> And at the end, call site could decide does it want to use the string or
> not.


I should note here that this is pretty much the "fail" method for Monad,
which is widely considered to have been a mistake.

-- 
brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140109/ac35c0b5/attachment.html>


More information about the Haskell-Cafe mailing list