[Haskell-cafe] Anonymous types

Thomas Conway drtomc at gmail.com
Fri Sep 15 00:42:48 EDT 2006

Hi all,

Is there any deep and meaningful reason why Haskell doesn't have
anonymous discriminated union types?

I'm thinking of an example like:

data Amount = Amount Integer (Mg|G|Kg|T)

Now this particular case is perhaps unconvincing - a seperate Units
type would be quite sensible, however I'm thinking of translating
ASN.1 definitions into Haskell. ASN.1 allows SEQUENCE (record types)
and CHOICE (discriminated unions) as a kind of type constructor.

Not having to invent names for anonymous SEQUENCE and CHOICE types
would be nice.


More information about the Haskell-Cafe mailing list