[GHC] #10566: Move "package key" generation to GHC
GHC
ghc-devs at haskell.org
Tue Jun 23 21:24:32 UTC 2015
#10566: Move "package key" generation to GHC
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: ezyang
Type: bug | Status: new
Priority: normal | Milestone: 7.12.1
Component: Package system | Version: 7.10.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by ezyang):
> Sounds good in general terms. But up to now GHC has been primary a
module-at-a-time compiler. To compute a package key it needs to know all
about a package. Do you intend to do this by giving it a Backpack file
describing the package? Or what?
So, actually, we can do this very nicely: if you compile a GHC module with
`-hide-all-packages` and a list of `-package` flags, then GHC can infer
the package key by just looking at each exposed package, and including
their hash in the computed package key. So, in some since Cabal is still
"calculating" many of the important parameters of the package key (the
package name, version, and what dependencies are used), but GHC does the
actual final calculation in the end.
Here's how it looks without Backpack:
1. Cabal calls GHC with `-package-name foo-0.1 -hide-all-packages
-package-id bar-0.1-ABCD ...`
2. GHC computes the package state with the package flags, getting a list
of exposed packages with `PkgConfig`s
3. Compute the package key by hashing the source package ID and package
key of each included exposed package.
With Backpack it's a little trickier, because we don't necessarily want to
hash the package key of included packages: instead, you want to hash the
"version hash" of each package, which is like a package key but minus hole
instantiation.
> And how does Cabal get to know what key GHC computed?
My initial thought is a new major mode `ghc --package-key -package-name
foo-0.1 -hide-all-packages -package bar-0.1-ABCD ...` which outputs the
package key.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10566#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list