Hi,
I want to see how to modules in different files work. For that I 
have a code which accepts the variable in one file and calculates 
in another module to find a square. It compiles well, but it does 
not give the desired output. The code is below...

:- module read_int.
:- interface.
:- import_module io.

:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module string, exception, numSqr.

main-->
         print("Enter an int: "), flush_output,
         read_int(Int),
         print("The Square is : "), print(numSqr__numSqre(Int)), 
nl.

:- pred read_int(int::out, io__state::di, io__state::uo) is det.
read_int(Int) -->
         io__read_line_as_string(Result),
         {       Result = ok(Line),
                 remove_suffix(Line, "\n", IntString),
                 string__to_int(IntString, IntVal)
                 ->
                 Int = IntVal
         ;
                 throw("invalid entry, end-of-file, or I/O 
error")
         }.
----------------------------------------------------------------------
:- module numSqr.

:- interface.
:- pred numSqre(int, int).
:- mode numSqre(in, out) is det.

:- implementation.
:- import_module int.
numSqre(N,S):-
         ( if N = 0 then
                 S = 0
         else
                 S = N * N
         ).
:- end_module numSqr.
----------------------------------------------------------------------

Heres the output for the command is shown...
$ ./read_int
Enter an int: 12
The Square is : '<<predicate>>'

Plz tell me how to go about it i.e. displaying the square.

Thanks,

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

