Installer Haskell

to Haskell and Beyond!!!

tlpl: Pour installer Haskell (OS X et Linux) copiez/collez les lignes suivante dans un terminal :

curl | sudo zsh

Si vous êtes sous windows, téléchargez Haskell Platform et suivez les instructions pour utiliser Haskell LTS.

Si vous voulez savoir le pourquoi et le comment ; lisez le reste de l’article.

Pourquoi ?

La plus grande faiblesse d’Haskell n’a rien à voir avec le langage en lui-même mais avec son écosystème.

The main problem I’ll try to address is the one known as cabal hell. The community is really active in fixing the issue. I am very confident that in less than a year this problem will be one of the past. But to work today, I provide an install method that should reduce greatly two effects of cabal hell:

  • dependency error
  • lost time in compilation (poor polar bears)

With my actual installation method, you should minimize your headache and almost never hit a dependency error. But there could exists some. If you encounter any dependency error, ask gently to the package manager to port its package to stackage.

So to install copy/paste the following three lines in your terminal:

curl | sudo zsh


You can read the script and you will see that this is quite straightforward.

  1. It downloads the latest GHC binary for you system and install it.
  2. It does the same with the cabal program.
  3. It updates your cabal config file to use Haskell LTS.
  4. It enable profiling to libraries and executables.
  5. It installs some useful binaries that might cause compilation error if not present.

As the version of libraries is fixed up until you update the Haskell LTS version, you should never use cabal sandbox. That way, you will only compile each needed library once. The compiled objects/binaries will be in your ~/.cabal directory.

Some Last Words

This script use the latest Haskell LTS. So if you use this script at different dates, the Haskell LTS might have changed.

While it comes to cabal hell, some solutions are sandboxes and nix. Unfortunately, sandboxes didn’t worked good enough for me after some time. Furthermore, sandboxes forces you to re-compile everything by project. If you have three yesod projects for example it means a lot of time and CPU. Also, nix didn’t worked as expected on OS X. So fixing the list of package to a stable list of them seems to me the best pragmatic way to handle the problem today.

From my point of view, Haskell LTS is the best step in the right direction. The actual cabal hell problem is more a human problem than a tool problem. This is a bias in most programmer to prefer resolve social issues using tools. There is nothing wrong with hackage and cabal. But for a package manager to work in a static typing language as Haskell, packages must work all together. This is a great strength of static typed languages that they ensure that a big part of the API between packages are compatible. But this make the job of package managing far more difficult than in dynamic languages.

People tend not to respect the rules in package numbering1. They break their API all the time. So we need a way to organize all of that. And this is precisely what Haskell LTS provide. A set of stable packages working all together. So if a developer break its API, it won’t work anymore in stackage. And whether the developer fix its package or all other packages upgrade their usage. During this time, Haskell LTS end-users will be able to develop without dependency issues.

The image of the cat about to jump that I slightly edited can found here

  1. I myself am guilty of such behavior. It was a beginner error.

Published on 2014-08-16
Follow @yogsototh
Yann Esposito©
Done with Vim spacemacs & nanoc Hakyll

ADA: DdzFFzCqrhtAvdkmATx5Fm8NPJViDy85ZBw13p4XcNzVzvQg8e3vWLXq23JQWFxPEXK6Kvhaxxe7oJt4VMYHxpA2vtCFiP8fziohN6Yp