commercialhaskell / commercialhaskell/stack
Have stack run "ghc-pkg check"
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
It seems like a good idea to run `ghc-pkg check` periodically. I just got this error message (not sure what the cause is):
```
Building quickcheck-io-0.1.2...
Preprocessing library quickcheck-io-0.1.2...
/tmp/stack7730/quickcheck-io-0.1.2/src/Test/QuickCheck/IO.hs:7:18:
Could not find module ‘Test.QuickCheck.Property’
There are files missing in the ‘QuickCheck-2.8.1@Quick_8UnGnTXfSEEClQczG6tI7s’ package,
try running 'ghc-pkg check'.
Use -v to see a list of the files searched for.
```
Indeed, `ghc-pkg check --simple-output` yields a list of broken packages. Presumably we're trying to avoid `ghc-pkg check` yielding any broken packages (always unregistering things that get broken).
Sidenote: We should really have a way to reinstall snapshot packages in this circumstance: https://github.com/commercialhaskell/stack/issues/1476
I think the best approach to this would be to run `ghc-pkg check --simple-output` at the beginning of the build command execution, and compare with the output at the end of execution (even if an exception is thrown). If packages are freshly broken, complain loudly.
One question is whether this should be done by default - it could have quite a bit of runtime overhead. We could have some stack.yaml flag like `dev-mode: True` which enables costly checks and assertions and such (intended to be specified in the global stack.yaml).
Contributor guide
Assessment
This issue has not been assessed yet.