Haskell on Arch Linux

13 Oct 2012haskell

So, GHC 7.6.1 was released last month. And there was a new release of Cabal too, bumping the version number to 1.16 from 0.14. The Arch Haskell people did a great job of quickly producing Arch packages for the new version, which meant that everyone pulled the new versions when they did an update via pacman -Su. Unfortunately, there seems to be a problem. The new cabal-install version can’t read its own default configuration file and just fails more or less immediately. There seems to be a fix, but it’s not yet percolated into the Arch packages.

In the meantime, the Arch Rollback Machine is your friend. You can find the last known good packages there (ghc 7.4.2 and cabal-install 0.14.0-2–links for x86_64). You can make a working Haskell development environment by removing the latest ghc and cabal-install packages, downloading the last known good packages from ARM and installing them using pacman -U. You need to make sure that these packages subsequently don’t get updated by passing the --ignore ghc,cabal-install flags to pacman when you do an update.

Once you have a good GHC and cabal-install installation, I would strongly recommend using hsenv to do Haskell development within a sandbox–you don’t install any Haskell packages to either the global or user-local package database, but use a project-specific sandboxed package database. This more or less eliminates Cabal dependency hell. I no longer bellow like a wounded walrus when trying to install Yesod, frightening the dog and any other small mammals within a distance of two or three miles. I just create a hsenv sandbox, activate it, type cabal install yesod-platform, and watch in glee as everything installs without a hitch.