[Haskell-cafe] TIPS: To Insure Package Sanity

Albert Y. C. Lai trebla at vex.net
Thu Jan 31 02:19:26 CET 2013

If you possess multiple instances (may be different versions, may be 
same version different builds) of a package, life can be hard and 
confusing. The problems are explained in my


and faced by many people regularly. (Just read this mailing list.)

cabal-install has a mechanism for not adding more instances. It is 
available since version 0.14.0, or earlier. It is just little known.

It is also a bit manual. You have to give 1 instruction for each 
package. If you want to say it for n packages, you have to give n 
instructions. Also, if you give such an instruction for a package you do 
not already have, there is a problem: now you can't install that package.

To insure package sanity, add these lines to your $HOME/.cabal/config, 
one line per package you want to protect. (Cannot merge into one line.)

constraint: array installed
constraint: bytestring installed
constraint: Cabal installed
constraint: containers installed

Generally, do it for every package that comes with GHC, and every 
package that comes with the Haskell Platform if you have it, plus every 
package that you want stable. (You may omit packages that cannot 
possibly be on hackage, e.g., integer-gmp.)

Remember to revise those lines whenever you switch GHC versions or 
Haskell Platform versions, since their package lists change.

Alternatively, if you want even more manual work (in exchange for more 
fine-tuning perhaps?): every time you use "cabal install":

cabal install --constraint="array installed" --constraint="bytestring 
installed" --constraint="Cabal installed" --constraint="containers 
installed" ...

More information about the Haskell-Cafe mailing list