Hadrian: Treat package databases as immutable?
The mutable nature of GHC's package database introduces a bit of complexity into Hadrian for two reasons:
ghc-pkguses file locking to ensure safe concurrent mutation (see #8591 (closed)) on most operating systems, this currently isn't supported on Windows. Consequently, we still need mutual exclusion logic in Hadrian.
- Mutation introduces impurity into the build system, making caching more difficult
It may be worth considering rather treating package databases as immutable things in Hadrian: instead of registering new packages into the global inplace package database, rather conjure up a new one, ideally with only the packages which the build needs (although sadly Cabal doesn't make this easier). This conjuring could be done in a Shake oracle and therefore benefit from caching.