haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.61k stars 691 forks source link

gen-bounds could use caret bounds and could be more concise #10265

Open chreekat opened 3 weeks ago

chreekat commented 3 weeks ago

Current behavior

Currently, gen-bounds produces help text and uses traditional bounds:

$ cabal gen-bounds
Warning: The package list for 'hackage.haskell.org' is 60 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...

The following packages need bounds and here is a suggested starting point.
You can copy and paste this into the build-depends section in your .cabal
file and it should work (with the appropriate removal of commas).

Note that version bounds are a statement that you've successfully built and
tested your package and expect it to work with any of the specified package
versions (PROVIDED that those packages continue to conform with the PVP).
Therefore, the version bounds generated here are the most conservative
based on the versions that you are currently building with. If you know
your package will work with versions outside the ranges generated here,
feel free to widen them.

containers >= 0.6.7 && < 0.7,
optics-core >= 0.4.1 && < 0.5,
text-ansi >= 0.3.0 && < 0.4,

Suggested behavior

Put help text under --help and use caret bounds:

$ cabal gen-bounds
Warning: The package list for 'hackage.haskell.org' is 60 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...

containers ^>= 0.6.7,
optics-core ^>= 0.4.1,
text-ansi ^>= 0.3.0,

Rationale and context

Caret bounds are the right tool for the given job.

Removing the help text is just something I thought of at the last second when I was copy/pasting the output and finally read it all for the first time.

mpickering commented 3 weeks ago

Perhaps one argument for the current behaviour is that it's easier to edit the bounds if they have lower and upper bounds.