

On Sat, 09 Nov 2002 Fergus Henderson wrote :
>You need to add an explicit type qualifier to specify the type 
>for `Binr'.
>For example, if you want this code to read an int, change
>
>  	io__read_binary(Str, ResStr),
>
>to
>
>  	io__read_binary(Str, ResStr `with_type` io__result(int)),
>
>If you want it to read a float, use
>
>  	io__read_binary(Str, ResStr `with_type` io__result(float)),
>

I have tried this... at all the possible places where the 
variables are...
I have written the code below as
:- 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 `with_type` io__result(string)),
 		(
 			{ResStr = ok(Binr `with_type` string)}
 		->
 			io__write_string(" Binary representation of a term is : "),
 			io__write_binary(Binr `with_type` string), nl
 		;
 			{ ResStr = eof }
 		->
 			io__write_string(" End of File.\n")
 		;
 			io__write_string(" Error occured.\n"),
 			{ ResStr = error(Err1)} % Some error occurs, thats why I am 
writing this part
 			->
 			{ io__error_message(Err1, ErrMesg)},
 			io__write_string(ErrMesg)
 			;
 				[] % upto this part I have added from the last time to check 
why it comes here directly
 		)
 	;
 		{ Res = error(Err)}
 	->
 		{ io__error_message(Err, ErrMsg)},
 		io__write_string("Error occured: "),
 		io__write_string(ErrMsg)
 	;
 		[]
 	).
I get the error...
test3.m:025: In clause for `main(di, uo)':
test3.m:025:   in argument 2 of call to predicate 
`io:write_string/3':
test3.m:025:   mode error: variable `DCG_2' has instantiatedness 
`mostly_unique',
test3.m:025:   expected instantiatedness was `unique'.
For more information, try recompiling with `-E'.

After adding the epart for the tracking the error in the code 
mentioned I have got the above error.

Plz do assist.

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

