These instructions have been tested on Ubuntu 22.04 LTS and Linux Mint 21.1. You may need to modify them as appropriate for your Linux distribution.

Anti-virus software may interfere with the installation process. If you run into errors during the install, you can try temporarily disabling your anti-virus software.

If you experience problems during the installation process, you can go to a drop-in consultation session or ask for help on Ed.

Uninstall instructions (only if you have previously installed Haskell)

Note that there are many ways to install GHC, and therefore it is impossible for these uninstall instructions to work on all possible ways that GHC may have been installed. If you are having trouble removing a previous Haskell installation from your computer, please ask a tutor to help you uninstall Haskell from your machine before proceeding with the installation.

  1. Open a Terminal.
  2. Run sudo apt remove --purge haskell* ghc* cabal*.
  3. Run ghcup nuke.
  4. Run rm -rf ~/.ghcup ~/.ghc ~/.cabal.

Installing Haskell

  1. Open a Terminal
  2. Run the following command to install dependencies.

    sudo apt install -y build-essential curl libffi-dev libgmp-dev libncurses-dev libtinfo-dev zlib1g-dev git
    
  3. Run the ghcup installer by running the following command

    curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | BOOTSTRAP_HASKELL_GHC_VERSION=9.2.5 sh
    

    2-linux

    You will need to press enter a couple times when prompted.

    3-linux

    The installation will then commence. This may take several minutes.

  4. Wait until you see the following message.

    4-linux

  5. Close the current terminal and open a new terminal.

  6. Check the GHC installation by running ghc --version and then checking that it says The Glorious Glasgow Haskell Compilation System, version 9.2.5.

    5-linux

  7. Let’s install the Haskell libraries we need for this course. Run the following command.

    cabal install --lib codeworld-api-0.8.0 && cabal install doctest
    

    Wait for the command to finish. This may take several minutes.

Congratulations! Your Haskell installation should now be ready to go.

VSCode Setup

If you haven’t installed VSCode, you can download it from https://code.visualstudio.com

After installing VSCode…

  1. Launch VSCode.
  2. Select “File > Preferences > Extensions”, search for haskell and install the “Haskell Syntax Highlighting” extension by clicking the Install button.
    haskell-syntax-highlighting
  3. Enable the “Auto Save” feature by clicking “File > Auto Save”. autosave
bars search times arrow-up