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:
|
-- | In @Cabal-3.6@ this module have been rewritten. |
|
-- |
|
-- |
|
module Distribution.Types.VersionInterval ( |
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.)
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 bcan 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.VersionIntervalwas moved toDistribution.Types.VersionInterval.Legacyand 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" formVersionRangeshould be implemented for the "semantic" formVersionIntervalsas well; both are Boolean algebras.(For my use in
hackage-clithat would mean I could now support 2.4, then upgrade to 3.4, then to 3.8---needing to skip 3.6.)