API `Distribution.Types.VersionInterval` dropped `intersectVersionIntervals` etc. in 3.6
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Background: I am looking to implement a check whether some version constraint subsumes another one, for https://github.com/hackage-trustees/hackage-cli/issues/28. We know that `a subsumes b` can e.g. be implemented as `(a intersect b) = b`.
I notice that up to 3.4, there was [`intersectVersionIntervals`](https://hackage.haskell.org/package/Cabal-3.4.0.0/docs/Distribution-Types-VersionInterval.html#v:intersectVersionIntervals), and I traced this back to [2.4](https://hackage.haskell.org/package/Cabal-2.4.0.0/docs/Distribution-Types-VersionInterval.html#v:intersectVersionIntervals) (maybe even older).
In 3.6 this function is gone, apparently due to a rewrite: https://github.com/haskell/cabal/blob/96ea35dca786dd54d64e55a00b0da7f63f7f6e99/Cabal/src/Distribution/Types/VersionInterval.hs#L3-L6
It seems that the whole module `Distribution.Types.VersionInterval` was moved to [`Distribution.Types.VersionInterval.Legacy`](https://hackage.haskell.org/package/Cabal-3.6.0.0/docs/Distribution-Types-VersionInterval-Legacy.html#v:intersectVersionIntervals) and the former module was reimplemented from scratch, but supplying only parts of the former API. The legacy module is announced to be deleted in 3.8.
I propose to restore the deleted functionality to `Distribution.Types.VersionInterval`, at least the mathematically essential functions. Basically, all the algebraic operations present for the "syntactic" form `VersionRange` should be implemented for the "semantic" form `VersionIntervals` as well; both are Boolean algebras.
(For my use in `hackage-cli` that would mean I could now support 2.4, then upgrade to 3.4, then to 3.8---needing to skip 3.6.)
Contributor guide
Assessment
This issue has not been assessed yet.