
On 22/07/14 08:23, Joachim Breitner wrote:
[Replying to the list, in case it was sent to me in private by accident]
Hi Edward,
Am Montag, den 21.07.2014, 23:25 +0100 schrieb Edward Z.Yang:
Excerpts from Joachim Breitner's message of 2014-07-21 21:06:49 +0100:
maybe a stupid question, but how does the package key relate to the hash that "ghc-pkg" shows for package?
Fine question---this is definitely something that is different from the GSoC project. The short answer is, the current hash shown in ghc-pkg is the ABI hash associated with the InstalledPackageId, which is computed after GHC is done compiling your code; whereas the package key is a hash of the dependency graph, which can be done before compilation.
The longer answer is we now have three ID-like things, in order of increasing specificity:
Package IDs: containers-0.9 These are the "user visible" things that we expect users to talk about in Cabal file Package Keys: md5("containers-0.9" + transitive deps) These are the identifiers the compiler cares about: they are used for type equality, and contain a bit more detail than we expect a user to normally need---however, a user might need to refer to this to disambiguate in some situations. Installed Package IDs: ABI hash of compiled code This uniquely identifies an installed package in the database, up to ABI.
So, if two packages have the same IPID, their package keys are guaranteed to be the same, but not vice versa. (And likewise for package IDs.)
(Replying to Edward) It's not clear to me why identical IPID would imply identical package key. Can't two instances of a package compiled against different dependencies still have identical ABIs? Reviewing your patches is next on my queue... Cheers, Simon