Haskell Language Cabal Working with sandboxes


A Haskell project can either use the system wide packages or use a sandbox. A sandbox is an isolated package database and can prevent dependency conflicts, e. g. if multiple Haskell projects use different versions of a package.

To initialize a sandbox for a Haskell package go to its directory and run:

cabal sandbox init

Now packages can be installed by simply running cabal install.

Listing packages in a sandbox:

cabal sandbox hc-pkg list

Deleting a sandbox:

cabal sandbox delete

Add local dependency:

cabal sandbox add-source /path/to/dependency