2.2. Installing on Windows

Getting the Glasgow Haskell Compiler (GHC) to run on Windows platforms can be a bit of a trying experience. It should be much easier now than in the past, since all the software required to use GHC is included in the InstallShield.

An installation of GHC requires about 140M of disk space. To run GHC comfortably, your machine should have at least 64M of memory.

2.2.1. Installing GHC

Download the latest GHC distribution (ghc-5.02 InstallShield installer, 27M) from haskell.org.

When the installer has completed, make sure you add the location of the ghc bin/ directory to your path, as directed in the final dialog of the installer. You need to do this in order to bring the various GHC binaries into scope.

You can freely move the GHC tree once you've installed it just by copying the ghc-x.yy directory. You might want to do this in order to use GHC with tools that don't like spaces in paths (GHC is installed in \Program Files\Glasgow Haskell Compiler by default.

To test the fruits of your labour, try now to compile a simple Haskell program:

bash$ cat main.hs
module Main(main) where

main = putStrLn "Hello, world!"
bash$ ghc -o main main.hs
bash$ ./main
Hello, world!

OK, assuming that worked, you're all set. Go forth and write useful Haskell programs :-) If not, consult the installation FAQ (Section 2.2.2); if that still doesn't help then please report the problems you're experiencing (see Chapter 9).

Further information on using GHC under Windows can be found in Sigbjørn Finne's pages. Note: ignore the installation instructions, which are rather out of date; the Miscellaneous section at the bottom of the page is of most interest, covering topics beyond the scope of this manual.

2.2.2. Installing ghc-win32 FAQ I'm having trouble with symlinks. I'm getting “permission denied” messages from the rm or mv. I'm having trouble with symlinks.

Symlinks only work under Cygwin (Section, so binaries not linked to the Cygwin DLL, in particular those built for Mingwin, will not work with symlinks. I'm getting “permission denied” messages from the rm or mv.

This can have various causes: trying to rename a directory when an Explorer window is open on it tends to fail. Closing the window generally cures the problem, but sometimes its cause is more mysterious, and logging off and back on or rebooting may be the quickest cure.