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

Set Cabal version to 3.0 when set notation is used in tested-with field #577

Open
pgujjula opened this issue Apr 17, 2024 · 3 comments
Open

Comments

@pgujjula
Copy link

Cabal >= 3.0 allows set notation in the tested-with field, such as

tested-with: GHC == { 8.6.3, 8.4.4, 8.2.2, 8.0.2, 7.10.3, 7.8.4, 7.6.3, 7.4.2 }

When we use set notation in the tested-with field in package.yaml, the field is copied to the .cabal file, but the cabal-version is not set to >= 3.0 as needed. This results in the following error when we try to cabal build using the generated cabal file:

unexpected version set syntax used. To use this syntax the package needs to specify at least 'cabal-version: 3.0'. Alternatively, if broader compatibility is important then use a series of single version constraints joined with the || operator: ==8.6.3 || ==8.4.4 || ==8.2.2 || ==8.0.2 || ==7.10.3 || ==7.8.4 || ==7.6.3 || ==7.4.2

   20 | tested-with:
   21 |     GHC == { 8.6.3, 8.4.4, 8.2.2, 8.0.2, 7.10.3, 7.8.4, 7.6.3, 7.4.2 }
      |                                                                       ^                                   ^
@sol
Copy link
Owner

sol commented Apr 20, 2024

There are two things here:

  1. Should hpack accept.
  2. How should hpack render it.

Regarding (1), should hpack accept something like:

tested-with:
  GHC:
    - 8.6.3
    - 8.4.4
    - ...

Regarding (2), we could still always render this as tested-with: GHC == 8.6.3, GHC == 8.4.4, ... for maximum compatibility. Or is there a reason not to?

Finally, for your original request, when tested-with is given as a string, then I'm not eager to look at it and pass it through transparently. In that case it would be the responsibility of the user to adjust the cabal-version as needed.

@pgujjula
Copy link
Author

Regarding (1), that seems reasonable to me to accept. Regarding (2), that also seems like a reasonable way to render it. It also makes sense to just pass through tested-with transparently when it's passed as a string.

Also, as I think about it more, I think the current option of writing

tested-with:
  - GHC == 8.6.3
  - GHC == 8.4.4
  - ...

seems like an acceptable workaround (though a little less aesthetically pleasing).

@sol
Copy link
Owner

sol commented Jul 26, 2024

Regarding (1), that seems reasonable to me to accept.

PRs welcome.

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