some hours of tooling

Posted on March 31, 2017

I have to update the Haskell compiler. I anticipate a few hours of boring struggling with my system and it’s tooling. Writing can help me to reap some learning out of the experience and improve my process. I don’t expect anyone to find this interesting.

My compiler is installed via Nix:

 ~ $ which ghc
/home/francesco/.nix-profile/bin/ghc

I don’t expect Nix to provide the most recent version, but the update commands are simple so i might as well run them. Luckily i took a note about how to do that.

 ~ $ nix-env --upgrade haskellPackages.ghc
error: cannot coerce a set to a string, at /nix/store/4h2xc7xql5p8rg0fmq69bxmc1bgfqkwi-nixpkgs-17.09pre104746.3d5e451/nixpkgs/pkgs/development/interpreters/ruby/default.nix:57:17

The upgrade command fails with an error which seems related to interpreting something via Ruby. I shouldn’t be having anything to do with Ruby for a task like this. Also, Nix is being unstable on updates, which is the main features i expect from it. I will try to just ditch Nix for Haskell. The only reason i use Nix with Haskell is to expose a binding to the Z compression library, but hopefully with a more recent version of the compiler, that won’t be needed anymore.

Removing the version of the compiler provided by Nix would make troubleshooting easier, but i’m not sure that ditching Nix is going to be the best decision in the end, so i will try to install a new compiler and use it side by side with the one provided by Nix.

Now, the problem is not the compiler in itself but the Cabal system, because of the shared status represented by the installed packages, and the interactions wyth the operative system via the system libraries.

 ~ $ which cabal
/home/francesco/.nix-profile/bin/cabal

Also Cabal is provided by Nix.

Enter Stack

Stack actually has been designed in order to solve all of these problems. Let’s give it a try.

Fixed

Using Stack, without changing anything in my system, i can cleanly replicate exactly the same failure Hackage is producing when trying to build my package. I’m all sorted. The boring hours of system fixing were avoided by simply using Stack! 😊

Now the Haskell part

I still have to fix a problem with dependencies that i don’t understand clearly … that can take a boring while.