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

Brandon Allbery allbery.b at gmail.com
Fri Jan 10 15:28:35 UTC 2014


On Fri, Jan 10, 2014 at 5:12 AM, Vlatko Basic <vlatko.basic at gmail.com>wrote:

> However, what I was trying to find out were the reasons for the way it is
> *implemented*. When I look at the code for Maybe and Either, it seems to me
> like the violation of the "do not repeat yourself" principle. That
> principle is taken rather seriously in Haskell. Even HLint has "Reduce
> duplication" suggestion. *Some* of the code I looked at appears the same.
>

Less so than you'd think, or there wouldn't be so much resistance to (for
example) replacing list-specific stuff in Prelude with the more general
Foldable/Traversable ones. The pressure for simple and easy to understand
stuff (like Maybe vs. Either () or whatever) turns out to be stronger.

-- 
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/20140110/b6811e4b/attachment.html>


More information about the Haskell-Cafe mailing list