[mercury-users] Strange Error Message
Gustavo A. Ospina
gos at info.ucl.ac.be
Tue Jul 31 19:06:30 AEST 2001
Hello,
I got an error message when compiling this function:
:- pred print_pred_call(io:output_stream, log_pred, io:state, io:state).
:- mode print_pred_call(in, in, di, uo) is det.
print_pred_call(Stdout, Pr) -->
( {Pr = cut},
io:print(Stdout, '!')
;
{Pr = unif(Var, Expr)},
io:write_string(Stdout, Var),
io:write_string(Stdout, " = "),
print_expr(Stdout, Expr)
;
{Pr = pred_call(P, Exprs)},
io:write_string(Stdout, P),
io:print(Stdout, '('),
print_ls_expr(Stdout, Exprs),
io:print(Stdout, ')')
).
This function is on the implementation part. 'log_pred' is a type
imported from another module, defined as:
:- type log_pred --->
cut
; unif(string, log_expr)
; pred_call(string, list(log_expr)).
The error is the following (with the -E flag):
xxx.m:117: In clause for predicate `lpid_to_prolog:print_pred_call/4':
xxx.m:117: error: ambiguous overloading causes type ambiguity.
xxx.m:117: Possible type assignments include:
xxx.m:117: V_23 :: pred(T, T) or (pred)
You will need to add an explicit type qualification to resolve the
type ambiguity.
The way to add an explicit type qualification
is to insert a call to a dummy predicate whose `:- pred'
declaration specifies the appropriate argument types.
Number line is the corresponding to the head of the clause print_pred_call.
The error is not clear to me: what variable is really the one having
conflicts with types?
I tried qualifying the variable Pr with its type, log_pred (using the
'with type' expression), and making explicit the module prefixes for the
type constructors in the switch, but it didn't work.
Maybe am I using an "ambiguous" name for some type constructor in Pr? I
really don't know.
I'll thank you for any help.
+ Gustavo +
--------------------------------------------------------------------------
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