ghci, -O

S.D.Mechveliani [email protected]
Wed, 02 May 2001 11:29:38 +0400


I fear there is certain misunderstanding about  -O  usage with
ghc-5.00 interactive.

Simon Marlow  and  User's Guide (Section 4.4)  say that  

> -O does not work with  ghci.
> For technical reason, the bytecode compiler doesn't interact 
> well with one of the optimization passes
> [..]

What is a bytecode compiler? 
The one that prepares a lightly compiled code for the interpreter?

What I meant is something like this: 
to compile                       ghc -c -O Foo.hs
in the batch mode and then run   ghci 
                                 ...
                                 Preude> :load Foo 
                                 ...
                                 Foo> sm [1..9999000]

I tried this with certain small function  Foo.sm,  and it works,
and runs better than when compied with -Onot.

Now, as I see that  ghci  can load and run the code made by  -O,
I wonder what the User's Guide means by saying 
"-O does not work with  GHCi". Maybe           ghci -O  ?
could be meaningful?

-----------------
Serge Mechveliani
[email protected]