ghc-pkg(1)
β¨ ghc-pkg β¨
okay bestie, buckle UP π this is the GHC Haskell Cabal package manager β yes that's the whole vibe of the ghc-pkg(1) page, and we're gonna go through it together, no skimming, no cap. β¨
πΈ NAME πΈ
ghc-pkg β GHC Haskell Cabal package manager π
π¦ SYNOPSIS π¦
ghc-pkg action [OPTION]...
that's it. action, then options. slay. π
π DESCRIPTION π
so like. a package is a library of Haskell modules that the compiler knows about. ghc-pkg is the lil tool that lets you add them to or remove them from a package database. by default it messes with the system-wide package database, but you can also act on the user's local package database, or on another file you specify entirely. options options options. β¨
to make a package available for ghc, you use ghc-pkg to register it. unregistering it removes it from the database. also β and this is the cute part β packages can be hidden, which makes ghc ignore the package by default without uninstalling it. exposing a package makes a hidden package available again. and on top of all that, ghc-pkg has a whole bunch of commands to query the package database. π
where a package name is required, you can name the package in full including the version number (e.g. network-1.0), or without the version number. naming a package without the version number matches all versions of the package, and the specified action gets applied to all the matching packages. a package specifier that matches all versions of the package can also be written pkg-*, so it's clearer that multiple packages are being matched. π
π ACTIONS π
register filename|-β Register the package using the specified installed package description. π₯update filename|-β Register the package, overwriting any other package with the same name. πunregister pkg-idβ Unregister the specified package. πexpose pkg-idβ Expose the specified package. πhide pkg-idβ Hide the specified package. πlist [pkg]...β List registered packages in the global database, and also the user database if--useris given. If a package name is given, all the registered versions will be listed in ascending order. Accepts the--simple-outputflag. πdotβ Generate a graph of the package dependencies in a form suitable for input for the graphviz tools. For example, to generate a PDF of the dependency graph: π
dot tred dot -Tpdf >pkgs.pdf
find-module moduleβ List registered packages exposing module module in the global database, and also the user database if--useris given. All the registered versions will be listed in ascending order. Accepts the--simple-outputflag. πlatest pkg-idβ Prints the highest registered version of a package. β¬οΈcheckβ Check the consistency of package dependencies and list broken packages. Accepts the--simple-outputflag. π©Ίdescribe pkgβ Give the registered description for the specified package. The description is returned in precisely the syntax required byghc-pkg register. πfield pkg fieldβ Extract the specified field of the package description for the specified package. Accepts comma-separated multiple fields. π§dumpβ Dump the registered description for every package. This is likeghc-pkg describe '*', expect that it is intended to be used by tools that parse the results, rather than humans. π€recacheβ Regenerate the package database cache. This command should only be necessary if you added a package to the database by dropping a file into the database directory manually. By default, the global DB is recached; to recache a different DB use--useror--package-confas appropriate. β»οΈ
π OPTIONS π
when you ask it to modify a database (register, unregister, update, hide, expose, and also check), ghc-pkg modifies the global database by default. specifying --user makes it act on the user database, or --package-conf can be used to act on another database entirely. when multiple of these options are given, the rightmost one is used as the database to act upon. π
commands that query the package database (list, latest, describe, field) operate on the list of databases specified by the flags --user, --global, and --package-conf. if none of these flags are given, the default is --global --user. β¨
--userβ Use the current user's package database. π«Ά--globalβ Use the global package database. π-f FILE,--package-conf=FILEβ Use the specified package config file. π--global-conf=FILEβ Location of the global package config. πΊοΈ--forceβ Ignore missing dependencies, directories, and libraries. πͺ--force-filesβ Ignore missing directories and libraries only. ποΈ-g,--auto-ghc-libsβ Automatically build libs for GHCi (withregister). π§-?,--helpβ Display a help message and exit. β-V,--versionβ Output version information and exit. π·οΈ--simple-outputβ Print output in easy-to-parse format for some commands. π§Ύ--names-onlyβ Only print package names, not versions; can only be used withlist --simple-output. π·οΈ--ignore-caseβ Ignore case for substring matching. π€
π ENVIRONMENT VARIABLES π
GHC_PACKAGE_PATHβ TheGHC_PACKAGE_PATHenvironment variable may be set to a:-separated list of files containing package databases. This list of package databases is used byghcandghc-pkg, with earlier databases in the list overriding later ones. This order was chosen to match the behaviour of thePATHenvironment variable; think of it as a list of package databases that are searched left-to-right for packages. π
If GHC_PACKAGE_PATH ends in a separator, then the default user and system package databases are appended, in that order. e.g. to augment the usual set of packages with a database of your own, you could say: π«Ά
export GHC_PACKAGE_PATH=$HOME/.my-ghc-packages.conf:
To check whether your GHC_PACKAGE_PATH setting is doing the right thing, ghc-pkg list will list all the databases in use, in the reverse order they are searched. π
π FILES π
Both of these locations are changed for Debian. Upstream still keeps these under/usr. Some programs may refer to that, but look in/varinstead. π¨
/var/lib/ghc/package.confβ Globalpackage.conffile. π/var/lib/ghc/package.conf.d/β Directory for library specificpackage.conffiles. These are added to the global registry. π
π§ SEE ALSO π§
ghc(1), runghc(1), hugs(1). π
π AUTHOR π
This manual page was written by Kari Pahula <kaol@debian.org>, for the Debian project (and may be used by others). π«Ά
okay that's the whole thing bestie, no notes, iconic behavior, periodt. π β¨
2010-01-27 β ghc-pkg(1) β that's the source, the version, and the date, and that's a wrap ππ
π¦ where this page comes from
- epel 10: ghc9.12-compiler 9.12.4-17.el10_3 Β· BSD-3-Clause
- fedora 43: ghc9.12-compiler 9.12.4-17.fc43 Β· BSD-3-Clause
- fedora 44: ghc9.12-compiler 9.12.3-14.fc44 Β· BSD-3-Clause
- fedora 44: ghc9.12-compiler 9.12.4-17.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms