Hackers: GHCi ready for gentle testing...

Simon Marlow simonmar@microsoft.com
Tue, 21 Nov 2000 09:46:43 -0800


The GHC Team are pleased to announce that our new arrival has taken his
first few faltering steps.  He's a little wobbly and has a tendency to
fall on his face occasionally, but there's a screenshot below for your
scrapbook.

There are two major new features:  ghc --interactive (otherwise known as
GHCi) is a Hugs-alike interpreter with support for loading compiled
code.  ghc --make is an hmake-alike batch compile system, which works
much faster for multi-module programs by keeping interfaces in memory
between compilations.  Initial tests show that this can reduce the time
taken to compile an unoptimised hsc by about 50%.

As of today, the new compiler is just about stable enough to compile all
of hslibs and bootstrap itself.  We haven't done much testing beyond
this yet.

To get interpreter support, you need to bootstrap with
before-ghci-branch, and add -optc-DGHCI to GhcRtsHcOpts.  To build the
Prelude for use with GHCi: turn off split-objs, build in lib/std, then
do "ld -r -x -o HSstd.o *.o", and do similarly for HScbits.o.

Have Fun!

Cheers,
	The GHC Team

$ ./ghc-inplace --interactive
 _____  __   __  ____
_________________________________________________
(|      ||   || (|  |)        GHC Interactive, version 5.00

||  __  ||___|| ||     ()     For Haskell 98.

||   |) ||---|| ||     ||     http://www.haskell.org/ghc

||   || ||   || ||     (|     Bug reports to:
glasgow-haskell-bugs@haskell.org 
(|___|| ||   || (|__|)
\\______________________________________________________

Loading package std ... resolving ... done.
Prelude> :?
   <expr>              evaluate <expr>
   :cd <dir>           change directory to <dir>
   :help               display this list of commands
   :?                  display this list of commands
   :load <filename>    load a module (and it dependents)
   :reload             reload the current program
   :set <opetion> ...  set options
   :type <expr>        show the type of <expr>
   :quit               exit GHCi
   :!<command>         run the shell command <command>
Prelude> 1+2
3
Prelude> :t 1+2
PrelNum.Integer
Prelude> length [1,23..10000]
455
Prelude> :!cat hello.hs
main = print "Hello, world!"
Prelude> :l hello
ghc: module Main: compilation IS required
Ok, modules loaded: Main.
Main> main
"Hello, world!"
Main> :t main
PrelIOBase.IO ()
Main> :r
ghc: module Main: compilation not required
Main> main
"Hello, world!"
Main> let primes n = n : filter (\m -> m `mod` n /= 0) (primes (n+1)) in
head (drop 50 (primes 2))
233
Main> let fact n = if n == 1 then 1 else n * fact (n-1) in fact 200
788657867364790503552363213932185062295135977687173263294742533244359449
963403342920304284011984623904177212138919638830257642790242637105061926
624952829931113462857270763317237396988943922445621451664240254033291864
131227428294853277524242407573903240321257405579568660226031904170324062
351700858796178922222789623703897374720000000000000000000000000000000000
000000000000000
Main> :q
Leaving GHCi.