Installing GHC 6.10 on Ubuntu Intrepid

Ubuntu Intrepid has GHC 6.8, and from the looks of it so will Jaunty when it releases next month. What if you want to install something that requires GHC 6.10?

Roll up your sleeves and do it yourself. Well, somewhat. Most of the hard work has already been done for you, but there’s still a bit of manual effort involved.

First, naturally, is installing GHC 6.10 itself. Luckily, there’s a PPA on Launchpad with GHC 6.10 packages for Intrepid. Just add the following to your package sources in Synaptic (or your package manager of choice):

deb intrepid main
deb-src intrepid main

Then upgrade or install ghc6, ghc6-prof, ghc6-doc, and haddock.

Unfortunately, all the Haskell modules in Intrepid proper only work with GHC 6.8, so they’ll all be removed from your system if you’ve installed them from there. There are a few modules in the aforementioned PPA that will work with GHC 6.10, but for the most part you’re going to be on your own.

Relatively speaking, of course. All the Haskell modules in Hackage (which is basically the Haskell equivalent to CPAN in the Perl world) can be automatically downloaded and installed for you using cabal-install. While installing Haskell packages manually is pretty simple, cabal-install also does all the work of tracking down dependencies and installing them for you as well.

The only catch is that cabal-install itself relies on a handful of modules that aren’t included with GHC 6.10 itself, so you get a little practice installing Haskell packages manually anyway. The bare minimum you need to install yourself is:

The manual install procedure basically works out to be this:

$ tar zxvf package-version.tar.gz
$ cd package-version
$ runghc Setup configure
$ runghc Setup build
$ sudo runghc Setup install

The only gotcha is that you’ll be tempted to install parsec-3.0.0 instead since, well, it’s newer and shinier, right? Alas, cabal-install requires a 2.x version of the parsec module, and if it doesn’t find it during bootstrap, it will just tell you to install parsec without mentioning that it’s picky about the version.

Luckily for you, you’re following these instructions and installed parsec-, so you won’t run into this. Now you need to install cabal-install:

$ tar zxvf cabal-install-0.6.2.tar.gz
$ cd cabal-install-0.6.2
$ ./

The bootstrap script will automatically fetch the other modules it needs (which it can do, since you kindly installed network- and put the cabal tool itself in ~/.cabal/bin/cabal.

Now, add that program to your PATH and run the following to have cabal fetch the list of available packages:

$ cabal update

As a side effect, it will also create a configuration file at ~/.cabal/config. By default, cabal will install modules in a user-specific directory. To install them system-wide under /usr/local, add the following to the config file:

user-install: False

Now if you want to install package whatever, just do this:

$ cabal install whatever

cabal-install will download the package and install it for you, along with any other packages it depends on. Now you’re all set to go.

If for some reason cabal-install fails when it tries to install a package, it might be that it for some reason failed to install a dependency of it. When I tried to install happstack, cabal-install bombed out, complaining it couldn’t install happy. Yet telling cabal-install to install happy worked fine, so I’m not sure why it never bothered to try to install it as a dependency when its error message clearly identified it as a required module for happstack. That’s something to try if you run into problems with cabal-install.

Congratulations! You’re now the proud owner of GHC 6.10 on Intrepid, with ready access to all the modules you could ever want.