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

Can we have if impl(cabal <3.10) project conditionals? #8933

Open
philderbeast opened this issue May 3, 2023 · 2 comments
Open

Can we have if impl(cabal <3.10) project conditionals? #8933

philderbeast opened this issue May 3, 2023 · 2 comments

Comments

@philderbeast
Copy link
Collaborator

philderbeast commented May 3, 2023

With the behaviour of packages in imports changing between cabal-3.8.* and cabal.3.10.* (see #8795), how can I work around this?

We have conditionals in project files but I don't see an if impl(cabal <3.10) in the docs.

Conditions in cabal may case on operating system, architecture, and compiler
SOURCE: Conditionals and imports

@philderbeast philderbeast changed the title Can we have if impl(cabal <3.10) conditionals projects? Can we have if impl(cabal <3.10) project conditionals? May 3, 2023
@gbaz
Copy link
Collaborator

gbaz commented May 3, 2023

Imports were only released in 3.8, and I consider the behavior that has now been changed simply a bugfix. Even if we added such constraints (I have reservations about them in general) they wouldn't apply to the now released 3.10 version of cabal, so couldn't resolve this specific issue.

I would propose just writing files that work with 3.10, or re-architecting the project so that imported project files are in the same directory as the cabal.project importing them.

In general, while we worry about cabal files being compatible with a wide range of Cabal-the-library versions, this is because such files are packaged up in tarballs and backwards-compat is essential. Project files just live in source repositories, and are easier to update, and for development purposes its therefore much more straightforward to update them "in place" or specify they only work with a specific cabal version.

This is to say that in general there is no policy for ensuring cabal.project files are compatible between different cabal-install versions, and further that such a policy would be exceedingly difficult, as their allowed flags are coupled to the allowed flags between cabal-install versions, which are likely to change with every major release.

@philderbeast
Copy link
Collaborator Author

philderbeast commented May 4, 2023

If "there is no policy for ensuring cabal.project files are compatible between different cabal-install versions" then an impl (cabal) conditional would help us wouldn't it?

I can't imagine how hard it would be to manage compiling with different ghc versions without having access to impl (compiler) at the project or package level or without having access to CPP conditionals on MIN_VERSION_library(x,y,z) or __GLASGOW_HASKELL__ in a module.

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

No branches or pull requests

2 participants