Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the relationship between ghc-pkg and cabal?

Tags:

haskell

ghc

cabal

With respect to how packages are created, installed and used in Haskell, what is the relationship between ghc-pkg and cabal?

What are their roles - when would you use one, over the other, or use both?

Are they complementary tools, competitive tools, or simply tools that do different jobs?

like image 931
Ben Lever Avatar asked Apr 25 '10 00:04

Ben Lever


2 Answers

Graphically, the dependencies are:

Packages GHC can use     |  Are registered with "ghc-pkg register"     | And (almost always) built with Cabal     | With build dependencies resolved by cabal-install     | From Hackage. 
like image 128
Don Stewart Avatar answered Oct 01 '22 14:10

Don Stewart


ghc-pkg is a direct interface to GHC's package database. Cabal is a tool that provides a consistent distribution structure for packages and a way to specify metadata such as dependencies between packages, version numbers, and build information.

Using Cabal to install a package will register it with ghc for you (among other things), but that's the extent of the overlap, really.

Note that ghc-pkg also provides functionality that (as far as I know) Cabal doesn't, such as hiding installed packages.

like image 34
C. A. McCann Avatar answered Oct 01 '22 14:10

C. A. McCann