The H2 Wiki


how-i-use-cabal

How I use cabal

– version 3.2.0.0.

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 https://downloads.haskell.org/~ghcup/0.1.9/i386-linux-ghcup-0.1.9 > ~/ghcup
chmod +x ~/ghcup

Then to install cabal it is a simple matter of

~/ghcup install cabal 3.2.0.0

The binary that it installs will end up at ~/.ghcup/bin/cabal-3.2.0.0 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.