Go to the first, previous, next, last section, table of contents.

Test that GHC seems to be working

The way to do this is, of course, to compile and run this program (in a file `Main.hs'):

main = putStr "Hello, world!\n"

First, give yourself a convenient way to execute the driver script `ghc/driver/ghc', perhaps something like...

% ln -s /local/src/ghc-x.xx/ghc/driver/ghc ~/bin/alpha/ghc
% rehash

Compile the program, using the `-v' (verbose) flag to verify that libraries, etc., are being found properly:

% ghc -v -o hello Main.hs

Now run it:

% ./hello
Hello, world!

Some simple-but-profitable tests are to compile and run the notorious `nfib' program, using different numeric types. Start with `nfib :: Int -> Int', and then try `Integer', `Float', `Double', `Rational' and maybe `Complex Float'. Code for this is distributed in `ghc/misc/examples/nfib/'.

For more information on how to "drive" GHC, either do `ghc -help' or consult the User's Guide (distributed in `ghc/docs/users_guide').


Go to the first, previous, next, last section, table of contents.