Search code examples
haskellghcbytestring

Haskell inbuilt libraries, where does it go?


In my /home/sk/.ghc/x86_64-linux-7.8.4/package.conf.d folder, there is an entry for bytestring package as,

bytestring-0.10.6.0-7682cf7d45ee92d104399a67f3bce6ba.conf

In my /opt/ghc/7.8.4/lib/ghc-7.8.4/package.conf.d folder, there is an entry for bytestring as,

bytestring-0.10.4.0-d6f1d17d717e8652498cab8269a0acd5.conf

Why does haskell store bytestring libraries in two different places. This is leading to compilation errors due to type/version mis-match.

How can i ensure, only one version of any library is stored and used at a time on my ubuntu 14.04 machine?


Solution

  • Why does haskell store bytestring libraries in two different places. This is leading to compilation errors due to type/version mis-match.

    Well, no. The problem is that you have two versions of the bytestring library installed, period. It doesn't matter whether they are in the same package database or not.

    You should fix this with ghc-pkg unregister bytestring-0.10.6.0 (first unregistering any packages that would break, if any) and then add a line

    constraint: bytestring installed
    

    to your ~/.cabal/config to prevent it from happening again. You probably want to do the same with other packages that came with GHC, at least all the ones that are dependencies of the ghc package (see ghc-pkg describe ghc).

    I don't know if there is a way to tell cabal to never install a second version of any package. (In practice I find temporarily installing multiple versions of packages useful enough that I would find it more annoying than helpful.)