[mercury-users] unresolved polymorphism in read_term_from_string

Jeff Thompson jeff at thefirst.org
Sun Feb 12 14:52:00 AEDT 2012

Hello again.  I've been working with the code parser, and gratified that 
it does what I expect.  The code below correctly outputs "test".  
However, the predicate is declared as
:- pred read_term_from_string(string::in, string::in, posn::out, 
read_term(T)::out) is det.

and the compiler outputs the warning:
test.m:004: In predicate `main'/2:
test.m:004:   warning: unresolved polymorphism.
test.m:004:   The variables with unbound types were:
test.m:004:     V_14: term.term(T)
test.m:004:     V_8: list.list(term.term(T))
test.m:004:     V_6: varset.varset(T)
test.m:004:     Term: term_io.read_term(T)
test.m:004:   The unbound type variables will be implicitly bound to the
test.m:004:   builtin type `void'.

Do I need to bind the type T to `void' when calling 
read_term_from_string?  If so, how?

Thanks for any help again,
- Jeff
:- module test.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.

:- implementation.
:- import_module parser, term, term_io.

main(!IO) :-
   read_term_from_string("", "test.", _Posn, Term),
   (if term(_, functor(atom(Name), _, _)) = Term then
     io.write_string(Name, !IO)
     io.write_string("no", !IO)).

mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au

More information about the users mailing list