[mercury-users] Typeclass problem (bug, misunderstanding, oth er?)
Ralph Becket
rbeck at microsoft.com
Thu Aug 3 23:58:57 AEST 2000
> From: Fergus Henderson [mailto:fjh at cs.mu.OZ.AU]
>
> > :- func solve(CSP, Node) = CSP <= csp(CSP, Node).
> > :- mode solve(in, unused) = out is det.
> >
> > ...
> > main -->
> > { node_type(DummyNode) },
> > { Sol = solve(CSP, DummyNode) },
> > ...
Unfortunately, this still doesn't seem to do the trick.
I've changed csp/1 to csp/2:
:- typeclass csp(T, N) <= node(N) where [ ... ].
and the signature of the search predicate to
:- pred solve(conflict_fn, bool, N, T, T) <= csp(T, N).
:- mode solve(in(conflict_fn), out, unused, in, out) is det.
the source code for solve/5 is the same as before
solve(CFn, Solved, DummyNode) -->
( if top_exhausted then
pop_stack(PoppedNodes),
push_agenda(PoppedNodes),
( if stack_exhausted then
{ Solved = no }
else
set_next_top_value(CFn),
solve(CFn, Solved, DummyNode)
)
else if agenda_exhausted then
{ Solved = yes }
else
pop_agenda(CFn, NewTop),
push_stack(CFn, NewTop),
solve(CFn, Solved, DummyNode)
).
and is called as
solve(CFn, Solved, DummyNode, CSP0, CSP)
Yet I still get the same error message:
csp.m:247: In predicate `csp:solve/5':
csp.m:247: type error: unsatisfied typeclass constraint(s):
csp.m:247: csp:csp(T, N), csp:csp(T, N), csp:csp(T, V_10), csp:csp(T,
V_12), c
sp:csp(T, V_16).
csp.m:247: In predicate `csp:solve/5':
csp.m:247: warning: unresolved polymorphism.
csp.m:247: The variables with unbound types were:
csp.m:247: NewTop :: N
csp.m:247: PoppedNodes :: (list:list(N))
csp.m:247: The unbound type variable(s) will be implicitly
csp.m:247: bound to the builtin type `void'.
The body of the clause contains a call to a polymorphic predicate,
but I can't determine which version should be called,
because the type variables listed above didn't get bound.
(I ought to tell you which call caused the problem, but I'm afraid
you'll have to work it out yourself. My apologies.)
I'm at a loss...
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