[Haskell-cafe] Why does Haskell have both `Maybe a` and `Either a ()`?

Albert Krewinkel albert+haskell at zeitkraut.de
Fri May 29 14:49:39 UTC 2020


Wiebe-Marten Wijnja writes:

> 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?

One difference that comes to mind is that there is only one way to write
the failing case for `Maybe a` (namely `Nothing`), but two ways for
`Either a ()`: `Right ()` and `Right ⊥`.


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


More information about the Haskell-Cafe mailing list