Wednesday, October 20, 2010

Installing Yesod (Haskell web framework) on Webfaction

Assuming that the latest GHC is installed on webfaction (see my previous posts for that process).

The first step is to install cabal. The best method is to download the cabal-install source package from hackage. In that source package there is a script called "bootstrap.sh". Running this script will download all the necessary packages (including Cabal itself) and install them in ~/.cabal.

Add cabal bin directory (~/.cabal/bin) to your system path.

Installing yesod is then as simple as "cabal install yesod".

The only real problem I faced with installing Yesod is that webfaction mounts /tmp with no-exec. Cabal sometimes requires execution of temporary files from /tmp. This will cause strange errors related to hsc-make or sometimes related to mmap in ghc. The workaround is to manually download the source for each troublesome package from hackage and run "cabal install" inside the source directory.

Otherwise the process is smooth sailing.

Note: The haskell platform is not easy to install on webfaction due to missing GLUT libraries. But if you follow the process above of using cabal install for installing only the libraries you need then things should work out fine without haskell platform.