Description
Background: I am looking to implement a check whether some version constraint subsumes another one, for hackage-trustees/hackage-cli#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
, and I traced this back to 2.4 (maybe even older).
In 3.6 this function is gone, apparently due to a rewrite:
cabal/Cabal/src/Distribution/Types/VersionInterval.hs
Lines 3 to 6 in 96ea35d
It seems that the whole module Distribution.Types.VersionInterval
was moved to Distribution.Types.VersionInterval.Legacy
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.)