As I know cabal
is a program to manage installation of packages like FreeBSD's pkg_add
.
But there is another tool called ghc-pkg
. I don't know why there are two different programs. What's the role of each of them and how are they related?
Cabal is a building and packaging library for Haskell, kind of "Haskell autotools". It reads .cabal
files and Haskell packages usually have a file Setup.hs
which uses Cabal to build the package. Then there's also cabal
command provided by the cabal-install package. It provides commands for running Setup.hs
script and some package management functions, like installing packages directly from Hackage. You should read this blogpost by Ivan Miljenovic which explains the role of Cabal, cabal-install and Hackage quite well.
ghc-pkg
is a lower-level tool for poking GHC's package database. Cabal is intended to work with every Haskell compiler, whereas ghc-pkg is obviously specific to GHC. You can't use ghc-pkg to build anything, you can just register packages you've built otherwise.