[mercury-users] Tuple type class instances
Simon Taylor
stayl at cs.mu.OZ.AU
Fri Jun 22 15:12:02 AEST 2001
On 21-Jun-2001, Michael Day <mikeday at lendtech.com.au> wrote:
>
> > This was discussed in detail on the mercury-developers list a while back,
> > when we were discussing the proposal to add support for tuples.
> > I suggest you check the mailing list archives.
>
> The last snippet I can find is this:
>
> I think this is something that we can reasonably hope to achieve
> without too much difficulty. More on this in an upcoming message!
Have a look at the mercury-developers archives for August and September 2000,
under the thread "[mdev.] for review: tuples [1]". You missed this:
>> From: Fergus Henderson (fjh at cs.mu.OZ.AU)
>> Date: Fri Sep 15 2000 - 17:41:24 EST
>>
>> On 11-Aug-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
>> > Well, personally, I want to have my cake and eat it too: I would like
>> > efficient working tuples AND in addition I want to be able to write
>> > instance declarations that will handle tuples of arbitrary arity.
>>
>> ... but unfortunately that seems to be a lot more difficult than I
>> had hoped.
>>
>> I guess we will just have to settle for having efficient working
>> tuples and just live with the issue regarding instance declarations.
> Even decomposable tuples where the compose/decompose is O(N) would be a big
> plus, I think.
No, it wouldn't. The typical use of this feature would be to iterate over
all elements of a tuple, which would be an O(N^2) operation. This kind of
performance issue tends to bite people often. We had similar problems
with string__first_char fairly recently.
If you really want a decomposable tuple-like type, use nested pairs.
Simon.
--------------------------------------------------------------------------
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