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

Brandon Allbery allbery.b at gmail.com
Thu Jan 9 15:10:07 UTC 2014


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

> With my current knowledge of Haskell, I do not see why is there Maybe if
> we have Either.
>

Because, while Either () a is isomorphic to Maybe a, it can be rather less
convenient to have to track that Left (). We can easily define a type that
doesn't need the extra work; why not use it? Especially when that
particular case turns out to be very common.

The fact that you *can* build up a standard library from first principles
every time you write a program does not mean that you *should*.

-- 
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/4e1b15cf/attachment.html>


More information about the Haskell-Cafe mailing list