[mercury-users] undiscriminated unions

Ralph Becket rafe at cs.mu.OZ.AU
Thu Jan 10 17:06:24 AEDT 2002


Dave Slutzkin, Thursday, 10 January 2002:
> Hi all.
> 
> Undiscriminated union types - there's an example of
> them in the language reference (I think it's
> employee), but the compiler says 'not implemented'.
> 
> Is this feature still not implemented, or should I get
> a later copy of Mercury?  It seems like a pretty
> trivial feature.

Mercury does not support undiscriminated union types.

You can obtain a similar effect in one of two ways.

The first is to use reflection (see how pprint__to_doc/2 identifies
lists, arrays, tuples etc. for special treatment).

The second is to use type classes.

Out of interest, what's the problem you're trying to solve that could
benefit from undiscriminated union types?

Cheers,

Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list