[mercury-users] Uniqueness and store.m

Sergey Khorev iamphet at nm.ru
Fri Dec 30 18:18:23 AEDT 2005


I'm trying to figure out how to use store.m and ran into problems with storing types that contain references.
The compiler version 0.12.1 gives me an error
sto2.m:024: In clause for `main(di, uo)':
sto2.m:024:   in argument 1 of call to predicate `store.new_ref/4':
sto2.m:024:   mode error: variable `V_18' has instantiatedness `unique(sto2.p(ground, ground))',
sto2.m:024:   expected instantiatedness was `unique'.

I can't understand where this constraint has arisen from. Is it possible to keep store__references in the store at all?



:- module sto2.

:- interface.

:- import_module io.

:- pred main(io::di, io::uo) is det.

:- implementation.

:- import_module store.

% type to keep in the store
:- type stype(S) ---> n(int)	% integer
	; s(string)		% string
	; p(			% a pair of references
	    store_ref(stype(S), S),
	    store_ref(stype(S), S)).

main(!IO) :-
	new(S0),
	new_ref(n(5), Rn, S0, S1),
	new_ref(s("abc"), Rs, S1, S2),
	new_ref(p(Rn, Rs), _Rp, S2, _S3).
--------------------------------------------------------------------------
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