Installing GHC (Programming Languages)
From Spivey's Corner
| Programming Languages |
| Syllabus |
| Outline |
| Problems |
| Labs |
| Software |
| FAQ |
The interpreters from the course can be built using any release of GHC from 6.10.x on. Several Linux distributions include GHC as a package, so it may be that all you need to do is install it via the package manager. If you're running Windows or Mac OS/X, then you can get the latest stable release from http://www.haskell.org/ghc/download.
Contents |
Under Windows
- Visit http://haskell.org/ghc/download, and click on the link under 'Current Stable Release'.
- Click on 'Binaries', then scroll down and click on 'Windows 2000/XP/Vista'.
- Click to download a file with a name like 'ghc-7.0.3-i386-windows.exe'. Alternatively, skip steps 1 and 2 and just click on the link here, at the risk of not getting exactly the latest version of GHC.
- After a moment, a dialog box like this appears: choose 'Run'.

(These screenshots show version 6.8.3, but version 7.0.x looks similar.) - The file will be downloaded, then this dialog box appears: choose 'Run' again.

- The GHC installer will start, and show the following dialog box. Click on 'Next' several times to accept the default settings, then on 'Install' to carry out the installation.

- It takes some time to unpack all the files that make up GHC. When the installation is done, click on 'Finish' to close the installer. By default, the Readme file for the release is now displayed. It contains nothing important, and you can close it.
Building Fun under Windows
When GHC is installed, you can download and build any of the interpreters from the course outline.
- First create a folder called (say) Proglan under My Documents, and open it in an Explorer window.
- Click on a link to one of the ZIP archives, such as this one for the basic Fun interpreter: Fun.zip, and when Windows asks, choose to open the archive.
- You will see an Explorer window that shows the files within the archive. Select all the files and drag them across to the Proglan folder. Now you can close the window showing the archive.
- Start a command window (using Windows/Accessories/Command Prompt) and change directory to your new folder with
cd "My Documents\Proglan". (The quotes are necessary because 'My Documents' contains a space.) - The
dircommand will now show the files you have downloaded. - Type
ghc --make Fun.hs -main-is Fun -o fun. This will compile all the modules that are needed, then link them together to make an executable filefun.exe. - Type
fun examples.funto run the Fun interpreter. - When you have finished, type
Ctrl-ZandReturnto exit.
Generally speaking, later packages of source code do not repeat source files that were contained in earlier packages, so it is necessary to download and unpack all the packages in turn into the same directory.
Under Debian or Ubuntu Linux
- Type 'sudo apt-get install ghc6' at the command prompt.
Building Fun under Linux
When GHC is installed, you can download and build any of the interpreters from the course outline.
- First create a directory called (say) proglan under your home directory.
- Click on a link to one of the Gzipped tar archives, such as this one for the basic Fun interpreter: Fun.tar.gz, and if you are asked, choose to save the archive on (say) the Desktop.
- Start a shell window and change to your new directory.
- Type
tar xvfz ~/Desktop/Fun.tar.gzto extract the files from the archive. - Type
ghc --make Fun.hs -main-is Fun -o fun. This will compile all the modules that are needed, then link them together to make an executable filefun. - Type
fun examples.funto run the Fun interpreter. - When you have finished, type
Ctrl-Dto exit.
Generally speaking, later packages of source code do not repeat source files that were contained in earlier packages, so it is necessary to download and unpack all the packages in turn into the same directory.