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

Johannes Erber Hannes_E at gmx.de
Thu Jan 9 15:07:48 UTC 2014


Hi Vlatko,

to keep programs clear, short and simple. What makes you choose String 
as type to replace Nothing?

Best,
Johannes

On 09/01/2014 14:50, Vlatko Basic wrote:
> 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
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list