Haskell  : How to install it

Photo by Joan Gamell on Unsplash

Haskell : How to install it

·

2 min read

Go to this website

image.png Choose GHCup method, go to GHCup Page

image.png Install on windows follow the instruction. Copy the command then open windows power shell, run the command:

Set-ExecutionPolicy Bypass -Scope Process -Force;[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;Invoke-Command -ScriptBlock ([ScriptBlock]::Create((Invoke-WebRequest https://www.haskell.org/ghcup/sh/bootstrap-haskell.ps1 -UseBasicParsing))) -ArgumentList $true

This script can download and install the following binaries:

  • ghcup - The Haskell toolchain installer
  • ghc - The Glasgow Haskell Compiler
  • cabal - The Cabal build tool for managing Haskell software
  • stack - A cross-platform program for developing Haskell projects (similar to cabal)
  • hls - (optional) A language server for developers to integrate with their editor/IDE

You will see the install process output:

INFO: No tasks running with the specified criteria.
Upgrading full system...
:: Synchronising package databases...
 mingw32                                                             1735.6 KiB   682 KiB/s 00:03 [#########################################################] 100%
 mingw64                                                             1749.9 KiB   336 KiB/s 00:05 [#########################################################] 100%
 ucrt64                                                              1800.5 KiB   760 KiB/s 00:02 [#########################################################] 100%
 clang32                                                             1719.1 KiB   509 KiB/s 00:03 [#########################################################] 100%
 clang64                                                             1740.1 KiB   821 KiB/s 00:02 [#########################################################] 100%
 msys                                                                 409.0 KiB  1243 KiB/s 00:00 [#########################################################] 100%
:: Starting core system upgrade...
warning: terminate other MSYS2 programs before proceeding
resolving dependencies...
looking for conflicting packages...

Packages (4) bash-5.2.009-1  filesystem-2022.01-6  msys2-runtime-3.3.6-4  pacman-6.0.1-25

Total Download Size:   11.25 MiB
Total Installed Size:  56.26 MiB
Net Upgrade Size:       0.99 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages...
 filesystem-2022.01-6-x86_64                                          107.7 KiB   191 KiB/s 00:01 [#########################################################] 100%
 pacman-6.0.1-25-x86_64                                                 5.5 MiB  2.76 MiB/s 00:02 [#########################################################] 100%
 bash-5.2.009-1-x86_64                                                  2.4 MiB   858 KiB/s 00:03 [#########################################################] 100%
 msys2-runtime-3.3.6-4-x86_64                                           3.2 MiB   832 KiB/s 00:04 [#########################################################] 100%
 Total (4/4)                                                           11.2 MiB  2.63 MiB/s 00:04 [#########################################################] 100%
(4/4) checking keys in keyring                                                                    [#########################################################] 100%
(4/4) checking package integrity                                                                  [#########################################################] 100%
(4/4) loading package files                                                                       [#########################################################] 100%
(4/4) checking for file conflicts                                                                 [#########################################################] 100%
(4/4) checking available disk space                                                               [#########################################################] 100%
:: Processing package changes...
(1/4) upgrading bash                                                                              [#########################################################] 100%
(2/4) upgrading filesystem                                                                        [#########################################################] 100%
(3/4) upgrading msys2-runtime                                                                     [#########################################################] 100%
(4/4) upgrading pacman                                                                            [#########################################################] 100%
:: To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n]

Now in the ghci , you can calculate the numbers or do other operations. You have installed Haskell successfully.

ghci> 1+2
3

use Ctrl+d, if you need leave ghci

ghci>
Leaving GHCi.