[Haskell-cafe] Why does Haskell have both `Maybe a` and `Either a ()`?
Jaro Reinders
jaro.reinders at gmail.com
Fri May 29 10:36:27 UTC 2020
One difference between Maybe a and Either a () in Haskell is also that `Nothing
< Just a` for any a. But `Right () > Left a` for any a.
On 5/29/20 12:24 PM, Wiebe-Marten Wijnja wrote:
> Greetings, everyone!
>
> Recently I was involved in a discussion on the new ML-style language
> 'gleam'.
>
> Gleam has for quite a while now only had an `Either a b` type,
> with all functions that in Haskell one would use a `Maybe a` for,
> working on an `Either a ()` instead.
>
> In the discussion(https://github.com/gleam-lang/gleam/issues/591), the
> language designers were asking the community whether it would make sense
> to add `Maybe` to the language as well,
> or keep using only `Either a ()`.
>
>
> My question: Is the difference between `Maybe a` and `Either a ()` only
> semantic and are they functionally equivalent,
> or are there differences in functionality as well?
>
>
> Have a nice day,
>
> ~Marten / Qqwy
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
>
More information about the Haskell-Cafe
mailing list