[Haskell-cafe] Why Maybe exists if there is Either?
Artyom Kazak
yom at artyom.me
Thu Jan 9 16:51:38 UTC 2014
On 01/09/2014 08:36 PM, Vlatko Basic wrote:
> But instance declarations wouldn't be needed because we already have
> all the instances for Either. The point would be to have them unified.
Consider a generic Show instance for Either – there’s no way¹ to make it
behave differently for Either () (or Maybe if it was a type synonym). I
think there are other cases in which we want Maybe to behave differently
from Either, but I can’t think of any on the spot.
¹ this point also applies to String, which is a type synonym for [Char]
– and it was solved somewhat inelegantly by adding an additional method
to Show typeclass *specifically* for showing lists of things.
More information about the Haskell-Cafe
mailing list