Hi,

On Thu, 07 Nov 2002 Nancy Mazur wrote :
>%-----------------------------------------------------------------------------
>:- module test.
>
>:- interface.
>
>:- import_module io.
>:- pred main(io__state::di, io__state::uo) is det.
>
>:- implementation.
>
>main -->
> 	io__open_input("blabla.txt", Result),
> 	(
> 		{ Result = ok(Stream) }
> 	->
> 		io__read_char(Stream, Input),
> 		(
> 			{ Input = ok(Char) }
> 		->
> 			io__write_string("First character = "),
> 			io__write_char(Char), io__nl
> 		;
> 			{ Input = eof }
> 		->
> 			io__write_string("End of File.\n")
> 		;
> 			% or else Input = error(_, _)
> 			io__write_string("Error occurred.\n")
> 		)
> 	;
> 		{ Result = error(Error) }
> 	->
> 		{ io__error_message(Error, ErrorMsg) },
> 		io__write_string("Error occurred: "),
> 		io__write_string(ErrorMsg)
> 	;
> 		[]
> 	).
The above code works fine.
I have written a similar code ....
:- module test3.

:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.

:- implementation.

main -->
 	io__open_binary_input("blah.txt", Res),
 	(
 		{ Res = ok(Str)}
 	->
 		io__read_binary(Str, ResStr),
 		(
 			{ResStr = ok(Binr)}
 		->
 			io__write_string(" Binary representation of a term is : "),
 			io__write_binary(Binr), nl
 		;
 			{ ResStr = eof }
 		->
 			io__write_string(" End of File.\n")
 		;
 			io__write_string(" Error occured.\n")
 		)
 	;
 		{ Res = error(Err)}
 	->
 		{ io__error_message(Err, ErrMsg)},
 		io__write_string("Error occured: "),
 		io__write_string(ErrMsg)
 	;
 		[]
 	).
I really cannot figure how to get around the following error shown 
below...
test3.m:005: In predicate `test3:main/2':
test3.m:005:   warning: unresolved polymorphism.
test3.m:005:   The variables with unbound types were:
test3.m:005:       Binr :: T
test3.m:005:       ResStr :: (io:result(T))
test3.m:005:   The unbound type variable(s) will be implicitly
test3.m:005:   bound to the builtin type `void'.

I know it may sound repetetive but plz tell me why the similar 
code should give me the error and what is the solution??

Thanks and Regards,

Noel

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users@cs.mu.oz.au
administrative address: owner-mercury-users@cs.mu.oz.au
unsubscribe: Address: mercury-users-request@cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request@cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------

