Ghc-pkg
The command ghc-pkg can be used to handle GHC packages. It is used both internally by other tools and by GHC users. This means that it contains many commands that are often not needed by an average user.
This tool is perhaps most often used for uninstalling unneeded packages and those packages that are incompatible with packages that the user wants to install. It is also used for checking which packages are installed or have been broken by installs of other packages.
For more information, see the official documentation.
Most used commands
List all the registered packages:
ghc-pkg list
Remove a package from the GHC administration:
ghc-pkg unregister <packageName | packageName-version>
Check for broken packages (see documentation on broken packages)
ghc-pkg check
Notice about ghc-pkg usage
Although ghc-pkg is useful, it shouldn't be needed for daily development. Invoking stack install with all the required packages often solves the same problems.