The H2 Wiki


How I use cabal

– version

I want to download cabal

I use ghcup. Personally I prefer the manual install. I am on a 32-bit Linux system so I do

curl -f > ~/ghcup
chmod +x ~/ghcup

Then to install cabal it is a simple matter of

~/ghcup install cabal

The binary that it installs will end up at ~/.ghcup/bin/cabal- and a symlink to it will probably be created at ~/.ghcup/bin/cabal.

I have a package in local source directory. I want to use it in another local package.

Suppose I have a package called package1 in a local source directory and whose cabal file is at /home/me/package1/package1.cabal; I want to use it in another local package I’m developing whose cabal file is /home/me/package2/package2.cabal.

I achieve this by adding an optional-packages stanza to package2’s cabal.project, as follows.

cabal install --lib doesn’t seem to work

Although cabal install --lib seems like it ought to support use cases like this, I’ve never been able to get it to work.