Safe Haskell | None |
---|---|
Language | Haskell2010 |
The only purpose of this module is to prevent the export of
VersionRange
constructors from
VersionRange
. To avoid creating orphan
instances, a lot of related code had to be moved here too.
Synopsis
- data VersionRange
- = AnyVersion
- | ThisVersion Version
- | LaterVersion Version
- | OrLaterVersion Version
- | EarlierVersion Version
- | OrEarlierVersion Version
- | WildcardVersion Version
- | MajorBoundVersion Version
- | UnionVersionRanges VersionRange VersionRange
- | IntersectVersionRanges VersionRange VersionRange
- | VersionRangeParens VersionRange
- anyVersion :: VersionRange
- noVersion :: VersionRange
- thisVersion :: Version -> VersionRange
- notThisVersion :: Version -> VersionRange
- laterVersion :: Version -> VersionRange
- earlierVersion :: Version -> VersionRange
- orLaterVersion :: Version -> VersionRange
- orEarlierVersion :: Version -> VersionRange
- unionVersionRanges :: VersionRange -> VersionRange -> VersionRange
- intersectVersionRanges :: VersionRange -> VersionRange -> VersionRange
- withinVersion :: Version -> VersionRange
- majorBoundVersion :: Version -> VersionRange
- data VersionRangeF a
- projectVersionRange :: VersionRange -> VersionRangeF VersionRange
- embedVersionRange :: VersionRangeF VersionRange -> VersionRange
- cataVersionRange :: (VersionRangeF a -> a) -> VersionRange -> a
- anaVersionRange :: (a -> VersionRangeF a) -> a -> VersionRange
- hyloVersionRange :: (VersionRangeF VersionRange -> VersionRange) -> (VersionRange -> VersionRangeF VersionRange) -> VersionRange -> VersionRange
- versionRangeParser :: forall m. CabalParsing m => m Int -> m VersionRange
- majorUpperBound :: Version -> Version
Documentation
data VersionRange Source #
Instances
anyVersion :: VersionRange Source #
The version range -any
. That is, a version range containing all
versions.
withinRange v anyVersion = True
noVersion :: VersionRange Source #
The empty version range, that is a version range containing no versions.
This can be constructed using any unsatisfiable version range expression,
for example > 1 && < 1
.
withinRange v noVersion = False
thisVersion :: Version -> VersionRange Source #
The version range == v
withinRange v' (thisVersion v) = v' == v
notThisVersion :: Version -> VersionRange Source #
The version range || v
withinRange v' (notThisVersion v) = v' /= v
laterVersion :: Version -> VersionRange Source #
The version range > v
withinRange v' (laterVersion v) = v' > v
earlierVersion :: Version -> VersionRange Source #
The version range < v
withinRange v' (earlierVersion v) = v' < v
orLaterVersion :: Version -> VersionRange Source #
The version range >= v
withinRange v' (orLaterVersion v) = v' >= v
orEarlierVersion :: Version -> VersionRange Source #
The version range <= v
withinRange v' (orEarlierVersion v) = v' <= v
unionVersionRanges :: VersionRange -> VersionRange -> VersionRange Source #
The version range vr1 || vr2
withinRange v' (unionVersionRanges vr1 vr2) = withinRange v' vr1 || withinRange v' vr2
intersectVersionRanges :: VersionRange -> VersionRange -> VersionRange Source #
The version range vr1 && vr2
withinRange v' (intersectVersionRanges vr1 vr2) = withinRange v' vr1 && withinRange v' vr2
withinVersion :: Version -> VersionRange Source #
The version range == v.*
.
For example, for version 1.2
, the version range == 1.2.*
is the same as
>= 1.2 && < 1.3
withinRange v' (laterVersion v) = v' >= v && v' < upper v where upper (Version lower t) = Version (init lower ++ [last lower + 1]) t
majorBoundVersion :: Version -> VersionRange Source #
The version range ^>= v
.
For example, for version 1.2.3.4
, the version range ^>= 1.2.3.4
is the same as >= 1.2.3.4 && < 1.3
.
Note that ^>= 1
is equivalent to >= 1 && < 1.1
.
Since: Cabal-2.0.0.2
data VersionRangeF a Source #
F-Algebra of VersionRange
. See cataVersionRange
.
Since: Cabal-2.2
Instances
projectVersionRange :: VersionRange -> VersionRangeF VersionRange Source #
Since: Cabal-2.2
embedVersionRange :: VersionRangeF VersionRange -> VersionRange Source #
Since: Cabal-2.2
cataVersionRange :: (VersionRangeF a -> a) -> VersionRange -> a Source #
Fold VersionRange
.
Since: Cabal-2.2
anaVersionRange :: (a -> VersionRangeF a) -> a -> VersionRange Source #
Unfold VersionRange
.
Since: Cabal-2.2
hyloVersionRange :: (VersionRangeF VersionRange -> VersionRange) -> (VersionRange -> VersionRangeF VersionRange) -> VersionRange -> VersionRange Source #
Refold VersionRange
Since: Cabal-2.2
versionRangeParser :: forall m. CabalParsing m => m Int -> m VersionRange Source #
VersionRange
parser parametrised by version digit parser
versionDigitParser
is used for allVersionRange
.integral
is used for backward-compatpkgconfig-depends
versions,PkgConfigVersionRange
.
Since: Cabal-3.0
majorUpperBound :: Version -> Version Source #
Compute next greater major version to be used as upper bound
Example: 0.4.1
produces the version 0.5
which then can be used
to construct a range >= 0.4.1 && < 0.5
Since: Cabal-2.2