Getting the Glasgow Haskell Compiler (post 5.02) to run on Windows platforms is a snap: the Installshield does everything you need.
To install GHC, use the following steps:
Download the Installshield
from the GHC download page
On Windows, all of GHC's files are installed in a single directory.
If you choose ``Custom'' from the list of install options, you will be given a
choice about where this directory is; otherwise it will be installed
The executable binary for GHC will be installed in the
of the installation directory you choose.
(If you have already installed the same version of GHC, Installshield will offer to "modify",
or "remove" GHC. Choose "remove"; then run
second time. This time it should offer to install.)
When installation is complete, you should find GHCi and the GHC documentation are available in your Start menu under "Start/Programs/Glasgow Haskell Compiler".
The final dialogue box from the install process reminds you where the GHC binary
has been installed (usually
If you want to invoke GHC from a command line, add this
to your PATH environment variable.
GHC needs a directory in which to create, and later delete, temporary files.
It uses the standard Windows procedure
find a suitable directory. This procedure returns:
The path in environment variable TMP, if TMP is set.
Otherwise, the path in environment variable TEMP, if TEMP is set.
Otherwise, there is a per-user default which varies
between versions of Windows. On NT and XP-ish versions, it might
c:\Documents and Settings\<username>\Local Settings\Temp
The main point is that if you don't do anything GHC will work fine; but if you want to control where the directory is, you can do so by setting TMP or TEMP.
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! bash$
You do not need the Cygwin toolchain, or anything else, to install and run GHC.
An installation of GHC requires about 140M of disk space. To run GHC comfortably, your machine should have at least 64M of memory.
At the moment, GHC installs in a fixed place (
but once it is installed, you can freely move the entire GHC tree just by copying
ghc-x.yy directory. (You may need to fix up
the links in "Start/Programs/Glasgow Haskell Compiler" if you do this.)
It is OK to put GHC tree in a directory whose path involves spaces. However, don't do this if you use want to use GHC with the Cygwin tools, because Cygwin can get confused when this happens. We havn't quite got to the bottom of this, but so far as we know it's not a problem with GHC itself. Nevertheless, just to keep life simple we usually put GHC in a place with a space-free path.
Symlinks only work under Cygwin (Section 184.108.40.206, “Installing”), so binaries not linked to the Cygwin DLL, in particular those built for Mingwin, will not work with symlinks.
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.