This tool parses a .cabal file and returns a set of Cabal constraints (either as command line flags or cabal.project.local stanzas) that constrain your dependencies to the latest major version still allowed your package.
It is a prototype for a feature that feasibly could be part of cabal itself, see haskell/cabal#8387.
This is necessary if your want your CI system to reliably assess PRs that extend the upper bound, as otherwise cabal may choose a lower version and a passing CI would be misleading.
$ cabal-force-upper-bound --help
Synthesize constraints to force testing the upper bound of cabal dependencies
Usage: cabal-force-upper-bound [--cabal-project] [--allow-newer] CABALFILE
Available options:
-h,--help Show this help text
--cabal-project create cabal.project.local syntax
--allow-newer also create --allow-newer flags
CABALFILE cabal file to read (.cabal)
Generating command line flags from the cabal file:
$ cabal-force-upper-bound *.cabal
"--constraint=Cabal-syntax ^>=3.10" "--constraint=base ^>=4.18" "--constraint=bytestring ^>=0.11" "--constraint=containers ^>=0.6" "--constraint=optparse-applicative ^>=0.18" "--constraint=pretty ^>=1.1" "--constraint=text ^>=2.0"
Generating cabal.project
stanzas (and also enabling the allow-newer
flag):
$./ cabal-force-upper-bound -- --cabal-project --allow-newer *.cabal
constraints: Cabal-syntax ^>=3.10
constraints: base ^>=4.18
constraints: bytestring ^>=0.11
constraints: containers ^>=0.6
constraints: optparse-applicative ^>=0.18
constraints: pretty ^>=1.1
constraints: text ^>=2.0
allow-newer: Cabal-syntax
allow-newer: base
allow-newer: bytestring
allow-newer: containers
allow-newer: optparse-applicative
allow-newer: pretty
allow-newer: text
This goes well with
haskell-bounds-bump-action
, auto-bumping dependency rangeshaskell-plan-bounds
, Generating dependencies from the actual CI builds
This action was created by Joachim Breitner mail@joachim-breitner.de, initially, during MuniHac 2023.