[Haskell-cafe] Why aren't there anonymous sum types in Haskell?

Elliot Stern eliyahu.ben.miney at gmail.com
Tue Jun 21 21:53:11 CEST 2011


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?

It seems to me that type inference on anonymous sum types would give you a
lot of the power that you get from heterogeneous lists.  Whenever you use a
heterogeneous list, you've essentially got a homogenous list of some sum
type. If you don't handle all of the cases of the sum type, then you're
going to eventually run into a type error.  It seems to me that having type
inference on anonymous sums would allow you to safely get the power of a
heterogeneous list.  Am I missing something here, or is this correct?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110621/f0b09f9b/attachment.htm>


More information about the Haskell-Cafe mailing list