Haskell - Environment Set Up
We have set up the Haskell programing environment online at − https://www.tutorialspoint.com/compile_haskell_online.php
This online editor has plenty of options to practice Haskell programing examples. Go to the terminal section of the page and type "ghci". This command automatically loads Haskell compiler and starts Haskell online. You will receive the following output after using the ghci command.
sh-4.3$ ghci GHCi,version7.8.4:http://www.haskell.org/ghc/:?forhelp Loading package ghc-prim...linking...done. Loading packageinteger gmp...linking... done. Loading package base...linking...done. Prelude>
If you still want to use Haskell offline in your local system, then you need to download the available Haskell setup from its official webpage − https://www.haskell.org/downloads
There are three different types of installers available in the market −
Minimal Installer − It provides GHC (The Glasgow Haskell Compiler), CABAL (Common Architecture for Building Applications and Libraries), and Stack tools.
Stack Installer − In this installer, the GHC can be downloaded in a cross-platform of managed toll chain. It will install your application globally such that it can update its API tools whenever required. It automatically resolves all the Haskell-oriented dependencies.
Haskell Platform − This is the best way to install Haskell because it will install the entire platform in your machine and that to from one specific location. This installer is not distributive like the above two installers.
We have seen different types of installer available in market now let us see how to use those installers in our machine. In this tutorial we are going to use Haskell platform installer to install Haskell compiler in our system.
Environment Set Up in Windows
To set up Haskell environment on your Windows computer, go to their official website https://www.haskell.org/platform/windows.html and download the Installer according to your customizable architecture.
Check out your system’s architecture and download the corresponding setup file and run it. It will install like any other Windows application. You may need to update the CABAL configuration of your system.
Environment Set Up in MAC
To set up Haskell environment on your MAC system, go to their official website https://www.haskell.org/platform/mac.html and download the Mac installer.
Environment Set Up in Linux
Installing Haskell on a Linux-based system requires to run some command which is not that much easy like MAC and Windows. Yes, it is tiresome but it is reliable.
You can follow the steps given below to install Haskell on your Linux system −
Step 1 − To set up Haskell environment on your Linux system, go to the official website https://www.haskell.org/platform/linux.html and choose your distribution. You will find the following screen on your browser.
Step 2 − Select your Distribution. In our case, we are using Ubuntu. After selecting this option, you will get the following page on your screen with the command to install the Haskell in our local system.
Step 3 − Open a terminal by pressing Ctrl + Alt + T. Run the command "$ sudo apt-get install haskell-platform" and press Enter. It will automatically start downloading Haskell on your system after authenticating you with the root password. After installing, you will receive a confirmation message.
Step 4 − Go to your terminal again and run the GHCI command. Once you get the Prelude prompt, you are ready to use Haskell on your local system.
To exit from the GHCI prolog, you can use the command ":quit exit".