[mercury-users] Restricted types with inst declarations? ELL type/inst usage?

doug.auclair at logicaltypes.com doug.auclair at logicaltypes.com
Wed Feb 22 05:56:04 AEDT 2006


Dear all,

Hi!  I wish to create a type bound to a subset of one of the previously defined types.  Specifically, I wish to define the type 'bit' and restrict it, solely, to the two ints '1' and '0'.  I've got only so far as:

:- type bit == int.

but when I try to restrict the type, I get compile errors:

% :- inst bit == bound(1; 0).   % WRONG!

What are the proper declarations to create this type?  I haven't had much success looking at the documentation in the reference manual on insts to resolve this issue, and I didn't see samples/ or extras/ that addressed this, but I do recall some discussion on this, three years ago, in one of these fora.  Is there some reference documentation or examples that guide one through using some of these features of Mercury?

Parenthetically, Zoltan, you created an ELL (even-lengthed list) data structure using type and mode declarations.  I was able to recreate that type, but I had difficulties using it properly in pred declarations.  Would you kindly send that code you created at this year's POPL so I see how to use an inst restricted type?

Thank you.

Sincerely,
Doug Auclair

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