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

Documentation of field tested-with #4894

Closed
andreasabel opened this issue Nov 15, 2017 · 5 comments · Fixed by #7604
Closed

Documentation of field tested-with #4894

andreasabel opened this issue Nov 15, 2017 · 5 comments · Fixed by #7604
Assignees

Comments

@andreasabel
Copy link
Member

The documentation http://cabal.readthedocs.io/en/latest/developing-packages.html?highlight=tested-with#pkg-field-tested-with currently just says

tested-with: compiler list

    A list of compilers and versions against which the package has been tested (or at least built).

The format of the compiler list needs to be explained by a representative example at least.

Cabal does have specific expectations here, as witnessed by this error:

cabal: <loc>: Parse of field 'tested-with' failed.
@hvr hvr self-assigned this Nov 15, 2017
@hvr
Copy link
Member

hvr commented Nov 15, 2017

Good catch! I'll try to improve the documentation (unless you want to take a stab at it).

For historical context, afaik, the tested-with field was considered a bit of an historical artifact at some point, and got more or less deprecated (e.g. Hackage doesn't show it anymore).

However, it turned out to be convenient to use in the travis-script generator in https://github.com/hvr/multi-ghc-travis, and that's (to my knowledge) the only tooling that still makes use of the tested-with field.

@asr
Copy link
Contributor

asr commented Aug 30, 2021

The current documentation shows some representative examples, so this issue can be closed.

@fgaz fgaz closed this as completed Aug 30, 2021
@andreasabel
Copy link
Member Author

Yes, that's probably good enough.
Though, I usually prefer the syntax without the , which is not show-cased.

tested-with:
  GHC == 9.0.1
  GHC == 8.10.4

@phadej
Copy link
Collaborator

phadej commented Aug 31, 2021

Comma is optional by historical mistake. My plan was to abolish optional commas from the format all together. Either the field doesn't have commas (e.g. other-extensions, ghc-options - single token elements) or it does (build-depends, tested-with - not so simple elements).

Commas really improve error messages when you screw up. There is leading or trailing commas if you want diff friendly lists:

tested-with:
  , GHC == 9.0.1
  , GHC == 8.10.1

EDIT: main motivation is indeed other-extensions field, where commas are optional at the moment. There are files on Hackage where comma usage was inconsistent, e.g. something like:

other-extensions: DeriveFunctor, DeriveFoldable DeriveTraversable

which worked. That doesn't work with cabal-version: 3.0 which requires punctuation to be consistent (either commas between every element, or no commas). Removing the choice would make format simpler.

@andreasabel
Copy link
Member Author

andreasabel commented Aug 31, 2021

@phadej wrote:

tested-with:
  , GHC == 9.0.1
  , GHC == 8.10.1

This is a syntax I can live with very well! It has the convenience of bullet lists where the first entry does not have a special syntax, so I can conveniently cut and rearrange lines.

However, I never dared to start a list with an empty entry, I would have written:

tested-with:
  GHC == 9.0.1
  , GHC == 8.10.1

Trying your syntax, I get a parse error.

$ cabal configure
Errors encountered when parsing cabal file ./hello.cabal:

hello.cabal:8:3: error:
unexpected ','
expecting white space or end of input

    7 | tested-with:
    8 |   , GHC == 9.0.1
      |   ^

This error does not give me a hint towards its solution. I will likely believe that I cannot start a list with a comma.

However, believing you, after a year of diving into v2-cabal I smell the problem. Bisecting through the cabal-versions, I find that starting with 3.0 it does parse. (However, then other changes to my .cabal file are demanded, like default-langage.)

TL;DR A diff-friendly example for tested-with should also be included in the docs, with sufficient hints to avoid the pitfalls I just described.

@andreasabel andreasabel reopened this Aug 31, 2021
@andreasabel andreasabel assigned andreasabel and unassigned hvr Aug 31, 2021
andreasabel added a commit to andreasabel/cabal that referenced this issue Aug 31, 2021
andreasabel added a commit to andreasabel/cabal that referenced this issue Sep 11, 2021
jneira pushed a commit to andreasabel/cabal that referenced this issue Sep 11, 2021
@mergify mergify bot closed this as completed in #7604 Sep 13, 2021
mergify bot added a commit that referenced this issue Sep 13, 2021
Additional examples in doc of `tested-with` (fix #4894)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants