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

Vlatko Basic vlatko.basic at gmail.com
Thu Jan 9 14:50:16 UTC 2014


Hello Cafe,

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

For example, Functor and Monad instances (and many others) of Maybe and Either 
are the same (except for fail).

In other words, this should hold:

     Maybe a  = Either String a     -- String or something else
     Nothing   = Left ""
     Just a       = Right a


I'm curious to find out what was the reasoning to make Maybe?
What is the added value with introducing it?
In which situations the above substitution does not hold?



Best regards,

vlatko



More information about the Haskell-Cafe mailing list