How to install Haskell on Windows in 2022?

Alex Rivers

Haskell is a functional programming and non-strict language. It was published in 1990 and was named after an American mathematician Haskell Brooks Curry. Big tech companies like Meta, Apple, and Microsoft use Haskell for huge-computational operations.

The Haskell Programming environment can run on any OS. This tutorial focuses on installation on Windows, and it can run on Windows 7 through to 10. The entire installation process is user-friendly, and anyone can install it.

Install Haskell on Windows

We have listed three different ways to download Haskell into your system.

  • By using Chocolatey
  • By using Visual Studio Code or VS Code
  • By downloading from the official website

Let’s dive into the installation process:

I. Installing Haskell using Chocolatey

Chocolatey is a command line application installer for Windows based on a developer-centric package manager called NuGet. It is different from other manual installations. It can add, update and uninstall programs in the background with very little user interaction. It makes users’ jobs easy.

Ensure you have Chocolatey on your Windows before you proceed. You can download it from here.

Enter the following command in the Powershell Command Line:

choco install haskell-dev

It should look something like this:

haskell command line

Ensure you type Y as it will install ghc, cabal, msys2, and more Haskell components.

If it runs error-free, it will be successfully downloaded, and a success message will be prompted at the end of the process.

II. Installing Haskell using Visual Studio Code (VS Code)

For this, ensure Visual Studio Code is already downloaded to your system.

It is very easy because all you need are two things:

  • Haskell Extension
  • Code Runner Extension
  1. Go to the marketplace using Ctrl+Shift+X or manually locate it on VS Code and download the Haskell extension. Read the documentation.
haskell extension

2. You will also find the Code Runner Extension in the marketplace. This is needed to run and compile your Haskell codes.

code runner haskell

When both are downloaded, you will be able to code in Haskell.

III. Installing Haskell Packages from the Website

Another way to download Haskell to your system is by downloading the packages from the official website. You must download the Glasgow Haskell Compiler (GHC), Cabal, and Stack. It is optional to download the Haskell language server.

It is nicely laid out on the website. You have to download them individually and run them on your system.

Downloading instructions are provided on the official website, along with documentation.

Conclusion

There are various ways to download Haskell’s environment into your system. We have talked about how you can download it to your system. Choose the one that you find hassle-free.

Happy coding!

Leave a Comment