haskell / haskell/cabal

Encode flag setting in InstalledPackageInfo? cabal doesn't rebuild installed packages when flags change.

Open
#8,702 1 comment 2 reactions 0 assignees View on GitHub
cabal-install: solver re: flag re: installed-package-info recompilation type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**
In https://github.com/haskell/text/issues/487 we noticed that there is no robust way to force `cabal-install` to reinstall a pre-existing library when flags are changed. In this case this means that there is no way for a user to enable the `text` package's `simdutf` flag if GHC ships with the flag disabled.

This is due to the fact that the only information `Cabal` has about pre-existing packages is that which is recorded in `InstalledPackageInfo`. As `InstalledPackageInfo` includes no knowledge of flags, `cabal-install` merely assumes that the pre-existing package's flag setting is compatible with that requested by the user.

For this reason, it seems reasonable to encode flag settings in `InstalledPackageInfo`. As, to my eyes, flags seem to be a slightly "higher-level" concern that the other `InstalledPackageInfo` fields (which encode precisely the information needed by GHC to compile and link against the package), I suspect this information best belongs in a "non-normative" IPI field. That is perhaps we introduce the convention that any field starting with `X-` will be ignored by GHC. This would allow `Cabal` to encode flag settings in an `X-Flag-Setting` field while keeping separate concerns separate and making it clear that GHC will not depend upon this knowledge.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.