Installing

Setting up a professional Haskell-programming environment can be surprisingly tricky. The instructions on these pages have worked for me, but all computers are different :). If you have any trouble setting up Haskell, please let me know!

Note

These instructions assume you have a *nix-like interface (e.g., MacOS, Linux, or WSL). If you have a Windows system without WSL, we may need extra help to install all the tools.

1 Install the Haskell toolchain

We will use a program called GHCup to install the Haskell toolchain.

Important

We need a custom installation process, to get all the pieces for our class to work together. Follow the instructions on this page to install GHCup, rather than the instructions on the GHCup website.

To install Haskell on a Mac, you first need to install the command-line tools (if you haven’t already).

To install the Haskell toolchain, open a terminal and run the following command:

curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | \
  BOOTSTRAP_HASKELL_NONINTERACTIVE=1 \
  BOOTSTRAP_HASKELL_GHC_VERSION=9.6.7 \
  BOOTSTRAP_HASKELL_INSTALL_HLS=1 \
  BOOTSTRAP_HASKELL_ADJUST_BASHRC=1 \
  sh

This command will take a long time to run.

After it completes successfully, the following elements will be installed on your computer.

GHCup
the installation manager
GHC
the Haskell compiler
Cabal
a package manager for Haskell
Stack
a program that manages Haskell projects and dependencies
HLS
the Haskell Language Server, which will allow us to connect our code editor to the Haskell toolchain

2 Test your installation

If you open a new terminal, you should now be able to run the following command and see the corresponding output:

ghci --version

The Glorious Glasgow Haskell Compilation System, version 9.6.7

ghci may take awhile to run the first time. It should load faster after that.

In the next step, we will run the toolchain on a more complex project.