HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulecabal-install-3.12.1.0Haskell2010

Distribution.Client.PackageHash

Functions to calculate nix-style hashes for package ids.

The basic idea is simple, hash the combination of:

  • the package tarball

  • the ids of all the direct dependencies

  • other local configuration (flags, profiling, etc)

See PackageHashInputs for a detailed list of what determines the hash.

  • 3 types
  • 5 values

Calculating package hashes

6 declarations

Those parts of the package configuration that contribute to the package hash.

Constructors

Instances1Show

Platform-specific variations

On Windows we have serious problems with path lengths. Windows imposes a maximum path length of 260 chars, and even if we can use the windows long path APIs ourselves, we cannot guarantee that ghc, gcc, ld, ar, etc etc all do so too.

So our only choice is to limit the lengths of the paths, and the only real way to do that is to limit the size of the InstalledPackageIds that we generate. We do this by truncating the package names and versions and also by truncating the hash sizes.

Truncating the package names and versions is technically ok because they are just included for human convenience, the full source package id is included in the hash.

Truncating the hash size is disappointing but also technically ok. We rely on the hash primarily for collision avoidance not for any security properties (at least for now).