Hackers: GHCi ready for gentle testing...
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
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
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.
The GHC Team
$ ./ghc-inplace --interactive
_____ __ __ ____
(| || || (| |) GHC Interactive, version 5.00
|| __ ||___|| || () For Haskell 98.
|| |) ||---|| || || http://www.haskell.org/ghc
|| || || || || (| Bug reports to:
(|___|| || || (|__|)
Loading package std ... resolving ... done.
<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> :t 1+2
Prelude> length [1,23..10000]
Prelude> :!cat hello.hs
main = print "Hello, world!"
Prelude> :l hello
ghc: module Main: compilation IS required
Ok, modules loaded: Main.
Main> :t main
ghc: module Main: compilation not required
Main> let primes n = n : filter (\m -> m `mod` n /= 0) (primes (n+1)) in
head (drop 50 (primes 2))
Main> let fact n = if n == 1 then 1 else n * fact (n-1) in fact 200