This repository contains the starter code for the practical exercises of the unit COMS20007: Programming Languages and Computation. To get started, there are two options:
- If you have a laptop on which you can install software, then we recommend you install the Haskell Toolchain.
- Otherwise, e.g. if you are using a Bill Brown Suite machine, we recommend you start using Gitpod.
In both cases you will need to use a little bit of the git tool. If you are not familiar with git, there are lots of resources online, for example from GitHub.
The following instructions will guide you through obtaining our recommended Haskell tools:
- GHC 9.0.1
- Cabal 3.4.0.0
Use the ghcup
tool. Everything can be done within your own user account (no raised privileges necessary).
- Set some environment variables in your terminal ready for the
ghcup
installation:
export BOOTSTRAP_HASKELL_NONINTERACTIVE=1
export BOOTSTRAP_HASKELL_GHC_VERSION=9.0.1
-
Install
ghcup
by following the instructions here within the same terminal session.- If your system has an old version of
curl
, such as in certain releases of Centos, then the shell command given in the instructions will fail with an error such as:In such a case, you can instead download the script at https://get-ghcup.haskell.org using your browser, save it somewhere accessible and with a name likecurl: option --proto: is unknown
ghcup-init
and then run it from your shell with:sh /path/to/ghcup-init
- If your system has an old version of
We recommend development on Windows Subsystem for Linux v2 (WSL2). If you want to install WSL2 on your Windows 10 machine, follow the instructions here before continuing as above.
However, you can also develop natively in Windows using the chocolatey package manager. You will need admin privileges.
-
Install the
chocolately
package manager by following the instructions at https://chocolatey.org/install. -
At a command prompt with Admin privileges, run:
choco install haskell-dev refreshenv
-
The package adds to the end of your
PATH
environment variable so, if you have previously installed versions of GHC or Cabal, then you should edit your environment variables to remove them. The versions installed bychocolatey
, which you should retain, are likely:C:\Users\<USERNAME>\AppData\Roaming\cabal\bin C:\tools\ghc-9.01\bin C:\tools\msys64
As a convenience, this repository is configured for use with Gitpod, which provides you with a fully configured development environment and IDE in the browser. Note that following the instructions below will require you to create a Gitpod account and consume your Gitpod instance time.
Starting the Gitpod instance directly from the main repository will provide you with a working environment, but will not allow you to permanently save any work. In order to make full use of the tool, we recommend that you fork the repository on Github (this requires a github account), then use the following workflow in each of your lab sessions:
-
Pull changes from the main repository into your fork (the following assumes your username is
user
, so your fork would behttps://github.com/user/labcode
); (using "Fetch upstream" on Github) -
Start the Gitpod instance by visiting
https://gitpod.io/#https://github.com/user/labcode
(not a link, since you must replaceuser
with the right user, group or org name); -
Do your work, committing and pushing as you would using VS Code on your local machine;
-
Shutdown your instance when you're done.
We cannot promise that no merge conflicts will arise in Step 1: we may have to fiddle with the sample code we provide even after it is released. But we promise to do our best to avoid them.