Install haskell on Ubuntu

October 4th, 2014 § 0 comments § permalink

As I thought of learning some functional programming, I started out with Haskell

In ubuntu you install via apt.

sudo apt-get install haskell-platform

This will install GHC(Glasgow Haskell Compiler), GHCi(GHC’s interactive environment) and cabal.

Try Haskell

You can try haskell using GHCi. Type ghci on command prompt and you will enter into its interactive environment.

GHC's interactive environment

GHC’s interactive environment

Congratulations, You are in. Now the prompt is Prelude>, if you can change this into ghci> by typing :set prompt "ghci> " , But that’s totally optional. You can try some basic arithmetic operations over GHCi.

Now if you wanna exit from this interactive environment, you can type in :quit. You can also type :? in GHCi for help or other options.


Cabal is a package and build system.It is only used to build packages. Where as Cabal-Install will help you to install and manage your Haskell libraries.

If its a first time you might need to run cabal update which will download the most recent list of packages available in Hackage.

Cabal Update

Cabal Update

Cabal will look for a .cabal file in the present working directory. If you don’t have one you can use cabal init to create one interactively.

Cabal init

Cabal init

Cabal can install packages only from hackage and should be build with cabal.


Hackage is a online repository of Haskell packages.