[Haskell-cafe] Anonymous types

Henning Thielemann lemming at henning-thielemann.de
Fri Sep 15 07:40:55 EDT 2006

On Fri, 15 Sep 2006, Thomas Conway wrote:

> 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.

I'm afraid you have to invent these names.

Btw. if you want to do more with units, see

More information about the Haskell-Cafe mailing list