Haskell and Ubuntu

by Mithrandir

For a normal user, wanting a haskell compiler only for some school courses, a simple apt-get command in Ubuntu is enough.  This is not true for someone wanting to really develop something good in Haskell. If he wants to use Ubuntu, then he will get into some problems. I hope that this article will solve some of them.

The big problem relies on installing cabal. It requires ghc 6.10 but the Ubuntu guys are packaging 6.08. Manual install is not good enough (some security faults). However, there is a way around this issue.

First,  remove any old haskell compilers and libs that you may have:

 sudo apt-get remove ghc6

Warning! Don’t try

 sudo apt-get remove ghc6*

because you’ll lose the ubuntu-desktop package. Fortunately, by just removing ghc6 you’ll also remove the libghc6* files. You can try a purge if you deem it necessary.

We are going to add a new PPA. Paste the following lines into  /etc/apt/sources.list.d/haskell.list, touching the file if needed and changing jaunty accordingly

deb http://ppa.launchpad.net/someone561/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/someone561/ppa/ubuntu jaunty main

The next one is optional – use it for package authentication.

sudo apt-key adv --recv-keys --keyserver\
 keyserver.ubuntu.com E51D9310

Update your system:

sudo apt-get update

And install all the needed packages

sudo apt-get install ghc6 ghc6-prof ghc6-doc haddock
sudo apt-get install libglut-dev happy alex libedit-dev zlib1g-dev
sudo apt-get install checkinstall

Go to Haskell Platform and get the sources.  Unpack them, cd to that directory and run:

./configure
make
sudo make install
sudo checkinstall -y

To test, you can do this:

sudo cabal install hoogle

That’s all folks

About these ads