ghc-pkg(1)

πŸ“¦ version 9.6.6, in debian trixie, ubuntu questing

✨ 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 --user is given. If a package name is given, all the registered versions will be listed in ascending order. Accepts the --simple-output flag. πŸ“‹
  • 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 --user is given. All the registered versions will be listed in ascending order. Accepts the --simple-output flag. πŸ”
  • 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-output flag. 🩺
  • describe pkg β€” Give the registered description for the specified package. The description is returned in precisely the syntax required by ghc-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 like ghc-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 --user or --package-conf as 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 (with register). πŸ”§
  • -?, --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 with list --simple-output. 🏷️
  • --ignore-case β€” Ignore case for substring matching. πŸ”€

🌈 ENVIRONMENT VARIABLES 🌈

  • GHC_PACKAGE_PATH β€” The GHC_PACKAGE_PATH environment variable may be set to a :-separated list of files containing package databases. This list of package databases is used by ghc and ghc-pkg, with earlier databases in the list overriding later ones. This order was chosen to match the behaviour of the PATH environment 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 /var instead. 🚨
  • /var/lib/ghc/package.conf β€” Global package.conf file. πŸ“„
  • /var/lib/ghc/package.conf.d/ β€” Directory for library specific package.conf files. 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