[Haskell-cafe] Is there some tool for inferring wide dependency ranges?

Askar Safin safinaskar at mail.ru
Mon May 31 00:21:50 UTC 2021


Hi, Oleg Grenrus and everybody. I solved my problem. I. e. I wrote the second tool from this letter: https://mail.haskell.org/pipermail/haskell-cafe/2021-May/134018.html . Result is in commit https://git.sr.ht/~safinaskar/check-cfg-ambiguity/commit/2ef843a42e51848608fc7156b1b70b1b691fba3a (it is possible that I will break everything in future commits, so here I refer to this particular commit).

Here is fragment of my check-cfg-ambiguity.cabal:
----------------
library
  exposed-modules: CheckCFGAmbiguity
  -- base 4.13 removed Monad.fail, so "before base 4.13 there was nothing"
  build-depends:
    -- CI-BOUNDS-BEGIN
    base >= 4.13.0.0 && <= 4.15.0.0,
    containers >= 0.6.2.1 && <= 0.6.4.1
    -- CI-BOUNDS-END
  default-language: Haskell2010
----------------
My CI script .build.yml parses this cabal file using ad-hoc regexes and sed (markers "CI-BOUNDS-BEGIN" and "CI-BOUNDS-END" help here; well, I have shell/sed addiction, and shell/sed [not haskell!] are still more convenient to me for such tasks) and extracts version info from this cabal file. Thus I don't have to repeat version numbers in CI script, i. e. I don't have DRY violation. Then CI script uses this info to build and test my package two times: for lower versions (with corresponding ghc version!) and for higher versions.

Here is resulting CI log: https://builds.sr.ht/~safinaskar/job/516259 .

Also: it was hard to find proper way to integrate cabal and doctest. Internet is full of misleading information. For example, https://hackage.haskell.org/package/cabal-doctest says that this package will become obsolete when command "cabal doctest" arrives and gives link https://github.com/haskell/cabal/issues/2327 to track progress. Link https://github.com/haskell/cabal/issues/2327 says that "cabal doctest" is implemented, so it seems that cabal-doctest is really deprecated and one should use "cabal doctest". But both https://hackage.haskell.org/package/cabal-doctest and https://github.com/haskell/cabal/issues/2327 don't say that "cabal doctest" not only ADDED, but also REMOVED: https://github.com/haskell/cabal/pull/7167/ . (Well, they didn't say this until today.)

After lots of searching internet I chose current approach, see lots of comments about this in check-cfg-ambiguity.cabal .

Of course, all my heroic efforts would be useless, if I did this for single package. I plan to publish more packages, and thus I did all this research

==
Askar Safin
http://safinaskar.com
https://sr.ht/~safinaskar
https://github.com/safinaskar


More information about the Haskell-Cafe mailing list