[m-dev.] for review: tuples [1]

Simon Taylor stayl at cs.mu.OZ.AU
Wed Aug 2 09:27:50 AEST 2000


Ralph Becket wrote:
> > From: Fergus Henderson [mailto:fjh at cs.mu.OZ.AU]
> > 
> > From a language design stand-point, one disadvantage of tuples
> > is that it is difficult to write type class instance declarations
> > for them, because they are unbounded in arity, and there is no
> > way to write a single instance declaration which works for all
> > tuple types.
> 
> Hang on, surely {T1}, {T2, T2}, {T1, T2, T3} are all distinct
> types, each with a very definite arity?

Yes.

> Without thinking too deeply about it, making a tuple type an instance
> of a typeclass would be an odd thing to do, but I don't see why it
> should be hard to handle.

It isn't -- there's a test case in the diff.

> Caveat: my impression is that the whole
> tuple thing is somewhat like having a pre-defined infinite set of
> types {T1}, {T1, T2}, ... with constructors {}/1, {}/2, ... built 
> into the language.
 
That's how the reference manual describes it (starting at {}/0).

Simon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list