Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode flag setting in InstalledPackageInfo? #8702

Open
bgamari opened this issue Jan 26, 2023 · 1 comment
Open

Encode flag setting in InstalledPackageInfo? #8702

bgamari opened this issue Jan 26, 2023 · 1 comment
Labels

Comments

@bgamari
Copy link
Contributor

bgamari commented Jan 26, 2023

Describe the bug
In haskell/text#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.

@phadej
Copy link
Collaborator

phadej commented Jun 10, 2024

In haskell/text#487 we noticed that there is no robust way to force cabal-install to reinstall a pre-existing library when flags are changed.

There are no robust way to force cabal-install to reinstall pre-existing library at all. E.g. if you want to amend ghc-options, or about anything actually.

Should one record ghc-options too in IPI? I think not.

IMO, a robust solution is to:

  • Have a way to force reinstalling a pre-existing library (possibly at the exact same version). We have constraints: pkg installed, we should have an opposite.
  • Given that cabal-install is able to do the above, then when requested a setting (flags, ghc-options, etc) which it doesn't know for sure, it reinstalls the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants