[Haskell-cafe] Why aren't there anonymous sum types in Haskell?
malcolm.wallace at me.com
Tue Jun 21 22:02:14 CEST 2011
On 21 Jun 2011, at 20:53, Elliot Stern wrote:
> A tuple is basically an anonymous product type. It's convenient to not have to spend the time making a named product type, because product types are so obviously useful.
> Is there any reason why Haskell doesn't have anonymous sum types? If there isn't some theoretical problem, is there any practical reason why they haven't been implemented?
The Either type is the nearest Haskell comes to having anonymous sum types.
If you are bothered because Either has a name and constructors, it does not take long before you realise that (,) has a name and a constructor too.
More information about the Haskell-Cafe