[mercury-users] Another Mercury Modes Problem

Bob McKay bob_mckay at mac.com
Sat Jun 1 01:48:05 AEST 2002


On Friday, May 31, 2002, at 11:51 PM, David Overton wrote:

> jn Fri, May 31, 2002 at 05:03:08PM +0900, Bob McKay wrote:
>> This seems
>> straightforward for types, but not possible for modes for the reasons
>> I previously mentioned (ie that you can't have parametric unique or
>> bound modes). Or am I missing something here?
>
> There is an implicit constraint `I =< ground' in this example which says
> that `I' is constrained to be a "sub-inst" of `ground'.  This includes
> all higher-order insts and bound(...) insts where the arguments are
> ground.  If you want `I' to be constrained to be a sub-inst of some 
> other
> inst, e.g.  `unique', you need to explicitly say this in the
> declaration.  The syntax for this is similar to the syntax for type
> class constraints.  E.g.
>
> :- mode append(di(unique_list_skel(I)), di(unique_list_skel(I)),
> 	out(unique_list_skel(I))) <= I =< unique.
>
> constrains `I' to be a unique inst.

Thanks David, this partly clarifies what is going on for me. I hadn't
appreciated that 'bound' and 'unique' were themselves insts rather
than properties of insts, with insts forming a partial order in this
way. But I'm still a little confused. In
:- inst listskel(Inst) == bound( [] ; [Inst | listskel(Inst)] ).
listskel is a function of type inst -> inst, I guess? But what is
'bound' in this context? And can any inst be used in this way, or is
this a special property of 'bound' and 'unique'?
>
> Note that the second of these example only works with fairly recent ROTD
> releases (since approx mid March).

Urrk. That means another system X rebuild. I think I'll pass for
the moment, and take Ralph's advice to avoid 'unique' modes.

	Best Wishes
	Bob

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