[mercury-users] /* unique */ and plain higher order instantiatedness

Ondrej Bojar obo at cuni.cz
Sat Mar 4 02:08:33 AEDT 2006


Hi.

I'd like to define the following function to convert plain functions 
into predicates that threads IO along the computation.

:- func ignore_io(func(A, B)=C) = (pred(A, B, C, io, io)).
:- mode ignore_io(func(in, in)=out is det)
           = (pred(in, in, out, di, uo)is det).

ignore_io(Func)
   = (pred(A::in, B::in, C::out, I::di, I::uo) is det :- C = Func(A, B)).

However the compiler complains:

suggest_for_lemma.m:169: In clause for `ignore_io((func(in, in) = out is 
det)) = (pred(in, in, out, di, uo) is det)':
suggest_for_lemma.m:169:   mode error in unification of `HeadVar__2' and 
lambda expression.
suggest_for_lemma.m:169:   Variable `HeadVar__2' has instantiatedness 
`(pred((ground >> ground), (ground >> ground), (free >> ground), (unique 
 >> clobbered), (free >> unique)) is det)',
suggest_for_lemma.m:169:   lambda expression has instantiatedness `/* 
unique */(pred((ground >> ground), (ground >> ground), (free >> ground), 
(unique >> clobbered), (free >> unique)) is de
t)'.

(Sorry for unreadable dump.) The only difference in instantiatednesses 
lies in prefixing the (pred...) with "/* unique */" or not.

Am I doing something wrong?

There is also a corresponding message near the ignore_io/1 application 
such as:

   tabulate_as_map_io(ignore_io(frameset_distance), GFrameset, 
HFrameset, Table, !IO),

(where tabulate_as_map_io expects pred(A, B, C, io, io) as its first 
argument).

This second message says:

suggest_for_lemma.m:175: In clause for `evaluate_framesets(in, in, di, uo)':
suggest_for_lemma.m:175:   in the return value of call to function 
`suggest_for_lemma.ignore_io/1':
suggest_for_lemma.m:175:   mode error: variable `V_15' has 
instantiatedness `free',
suggest_for_lemma.m:175:   expected instantiatedness was `(pred((ground 
 >> ground), (ground >> ground), (free >> ground), (unique >> 
clobbered), (free >> unique)) is det)'.

...so there seems to be "no output" from the ignore_io call. But this 
might go away as soon as the first problems is fixed.

Thanks for help,
   Ondrej.

P.S.: Thanks for the latest rotd, the clash between posix.exec and 
thread from concurrency seems to be fixed now.

-- 
Ondrej Bojar (mailto:obo at cuni.cz)
http://www.cuni.cz/~obo
--------------------------------------------------------------------------
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