[mercury-users] Mercury Types Problem

Ralph Becket rafe at cs.mu.OZ.AU
Thu Jun 20 15:43:08 AEST 2002


Bob McKay, Thursday, 20 June 2002:
> Hi folks; probably a fairly trivial syntax problem this time:
> 
> On Tuesday, May 28, 2002, at 02:01 PM, Ralph Becket wrote:
> >Tip: it's a good idea to name complex higher order types and modes:
> >
> >:- type eval_pred(T) == (pred(T, T, message, message, supply, supply)).
> >:- inst eval_pred    == (pred(in, uo(individuals), out, out, mdi, muo) 
> >is det).
> 
> I'm trying this as:
> 
> :- type eval_pred(Ind) == (pred(Ind, Ind, message, message, supply, 
> supply)).
> :- mode eval_pred == (pred(in, out, out, out, mdi, muo) is det).
> 
> :- pred eval_ind(eval_pred(ind)).	%1
> :- mode eval_ind(eval_pred).		%2
> 
> 
> eval_ind(Uneval_ind, Eval_ind, Defmessage, Fitmessage, RS0, RS1) :-
> 	<clause body>
> 
> gives the error messages
> 
> eval.m:017: Error: no determinism declaration for exported
> eval.m:017:   predicate `eval:eval_ind/1'.

This says you've missed off the `is <determinism>' part of the mode
declaration for eval_ind/1.

> eval.m:026: Error: clause for predicate `eval:eval_ind/6'
> eval.m:026:   without preceding `pred' declaration.

This says you've written a clause

eval_ind(A, B, C, D, E, F) :- ...

but you've only declared a pred with this name that takes a single
argument:

:- pred eval_ind(eval_pred(ind)).
                 ^^^^^^^^^^^^^^--- one argument.

> eval.m:016: Error: no clauses for predicate `eval:eval_ind/1'.

and you haven't written any eval_ind/1 clauses

> eval.m:026: Inferred :- pred eval_ind((rep:ind), (rep:ind), 
> (myutils:message), (
> myutils:message), (random:supply), (random:supply)).

but this is what the compiler managed to infer about the mysterious
eval_ind/6 clause!

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