In this tutorial, you will learn how to install Haskell programming language on Ubuntu 22.04.
If you are working and developing with Haskell programming language, then you will need to have a working Haskell environment on your machine.
Haskell compiler, allows you to build your haskell projects so that you can run them on your machine.
Haskell provides a shell script that can install Haskell on your machine easily via one single line command.
Step 1 - Install Haskell Dependencies
Haskell needs the following dependencies in order to be able to use it on your machine.
To install these depenendencies, you can do so by running the command below.
sudo apt install build-essential curl libffi-dev libffi8ubuntu1 libgmp-dev libgmp10 libncurses-dev libncurses5 libtinfo5

Step 2 - Update your system
Before installing Haskell on your Ubuntu 22.04 system, make sure that your system is up to date, and that there are no outdated packages.
To do so, simply check for updates using the command below
sudo apt update

Step 3 - Install Haskell
Now, on your terminal, run the following command to Install Haskell.
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh

Next, you will see the following prompt. Press enter to proceed installing Haskell

On the next prompt "Do you want ghcup to automatically add the required PATH variable to "/home/owlhowto/.bashrc"? Answer with Yes, by pressing P, and then enter.

Next, you will be asked whether you want to install Haskell language server. Answer with Yes again by pressing Y, and enter.

Next, you will be asked if you want to enable better integration of stack with GHCup. Press Y, if you want to proceed enabling it.

Now on the final prompt, you will be asked again to press Enter in order to install Haskell. Simply press Enter, and Haskell will begin downloading the required files.

Once the Installation process has been completed, you will see the following output.

Now in order to be able to use Haskell compiler on your terminal ghci
you need to either close your terminal window and reopen it.
To avoid closing your current terminal, and use ghci
on your current terminal window, simply source /.ghcup/env
to your ~/.bashrc
file.
source /home/owlhowto/.ghcup/env

Step 4 - Use Haskell Compiler
Now to use the Haskell compiler, you can do so by running the following.
ghci

Conclusion
In this tutorial, you learned how to install Haskell programming language on Ubuntu 22.04, by using the official installer GHCup.
You can now code on Haskell, and be able to build Haskell projects.