
Hi Artyom,
Yes, indeed.
But instance declarations wouldn't be needed because we already have all the
instances for Either. The point would be to have them unified.
But it is a problem that there are no data constructor synonyms in Haskell. So
at least pattern matching wouldn't be possible the simple way. Maybe
ViewPatterns could (partially) solve that.
vlatko
-------- Original Message --------
Subject: Re: [Haskell-cafe] Why Maybe exists if there is Either?
From: Artyom Kazak
Besides, even defining
type Maybe a = Either () a
in standard library wouldn’t be the same as
data Maybe a = Nothing | Just a
since in Haskell 98 type synonyms aren’t allowed in instance declarations, which means that programmers would still have to remember that `Maybe` is actually `Either ()` under-the-hood every time when writing an instance. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe