[mercury-users] Another Mercury Modes Problem
David Overton
dmo at cs.mu.OZ.AU
Tue May 28 17:00:56 AEST 2002
On Tue, May 28, 2002 at 04:45:12PM +1000, Ralph Becket wrote:
> David Overton, Tuesday, 28 May 2002:
> > On Tue, May 28, 2002 at 03:01:07PM +1000, Ralph Becket wrote:
> > >
> > > % These should be built-in, but aren't...
> > > %
> > > :- mode di(I) == unique(I) >> dead.
> > > :- mode uo(I) == free >> unique(I).
> >
> > The inst `unique(...)' takes a list of functors separated by `;' (the same
> > as `bound(...)'), not an inst.
>
> I was unsure of that syntax. How does one apply the unique attribute to
> a named inst?
You can't at the moment, although it might be a useful feature to add.
>
> > `di/1' is defined in builtin.m as
> >
> > :- mode di(I) == (I >> dead).
> >
> > `uo/1' is not defined, but it would be the same as `out/1' if it were.
>
> This would appear to require that every inst come in both shared and
> unique flavours, rather than being able to apply the unique attribute to
> the top-level functor at will.
Yes, if you require both ``flavours'' you need to declare two separate
insts.
> Which reminds me of a discussion I was having with Fergus: Fergus tells
> me that uniqueness goes "all the way down" and that this is what one
> typically wants. I can't see it, myself: I agree that one often wants a
> unique "spine", but the other arguments to a functor needn't (won't) be
> unique in the common case, as far as the examples I've been able to come
> up with are concerned. Would it cause major problems if uniqueness only
> applied to the functor, rather than recursively to all its arguments as
> well?
The uniqueness of `unique' goes all the way down. If you use
`unique(...)' you can have non-unique insts in the arguments of the
functors, e.g.
unique(no ; yes(ground))
is a perfectly valid inst although note that
bound(no ; yes(unique))
is _not_ allowed.
David
--
David Overton Computer Science and Software Engineering
PhD Student The University of Melbourne +61 3 8344 9159
Research Fellow Monash University (Clayton) +61 3 9905 5779
--------------------------------------------------------------------------
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