Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data 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
- withinRange :: Version -> VersionRange -> Bool
- foldVersionRange :: a -> (Version -> a) -> (Version -> a) -> (Version -> a) -> (a -> a -> a) -> (a -> a -> a) -> VersionRange -> a
- normaliseVersionRange :: VersionRange -> VersionRange
- stripParensVersionRange :: VersionRange -> VersionRange
- hasUpperBound :: VersionRange -> Bool
- hasLowerBound :: VersionRange -> Bool
- data VersionRangeF a
- cataVersionRange :: (VersionRangeF a -> a) -> VersionRange -> a
- anaVersionRange :: (a -> VersionRangeF a) -> a -> VersionRange
- hyloVersionRange :: (VersionRangeF VersionRange -> VersionRange) -> (VersionRange -> VersionRangeF VersionRange) -> VersionRange -> VersionRange
- projectVersionRange :: VersionRange -> VersionRangeF VersionRange
- embedVersionRange :: VersionRangeF VersionRange -> VersionRange
- isAnyVersion :: VersionRange -> Bool
- isAnyVersionLight :: VersionRange -> Bool
- wildcardUpperBound :: Version -> Version
- majorUpperBound :: Version -> Version
- isWildcardRange :: Version -> Version -> Bool
- versionRangeParser :: forall m. CabalParsing m => m Int -> CabalSpecVersion -> m VersionRange
Version ranges
data VersionRange Source #
Instances
Parsec VersionRange Source # |
Small history:
Set operations are introduced in 3.0
Operators are introduced in 1.8. Issues only a warning.
Wild-version ranges are introduced in 1.6. Issues only a warning.
|
Defined in Distribution.Types.VersionRange.Internal parsec :: CabalParsing m => m VersionRange Source # | |
Pretty VersionRange Source # |
|
Defined in Distribution.Types.VersionRange.Internal pretty :: VersionRange -> Doc Source # prettyVersioned :: CabalSpecVersion -> VersionRange -> Doc Source # | |
Structured VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal structure :: Proxy VersionRange -> Structure Source # structureHash' :: Tagged VersionRange MD5 | |
Data VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> VersionRange -> c VersionRange Source # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c VersionRange Source # toConstr :: VersionRange -> Constr Source # dataTypeOf :: VersionRange -> DataType Source # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c VersionRange) Source # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c VersionRange) Source # gmapT :: (forall b. Data b => b -> b) -> VersionRange -> VersionRange Source # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> VersionRange -> r Source # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> VersionRange -> r Source # gmapQ :: (forall d. Data d => d -> u) -> VersionRange -> [u] Source # gmapQi :: Int -> (forall d. Data d => d -> u) -> VersionRange -> u Source # gmapM :: Monad m => (forall d. Data d => d -> m d) -> VersionRange -> m VersionRange Source # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> VersionRange -> m VersionRange Source # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> VersionRange -> m VersionRange Source # | |
Generic VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal from :: VersionRange -> Rep VersionRange x Source # to :: Rep VersionRange x -> VersionRange Source # | |
Read VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal | |
Show VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal | |
Binary VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal put :: VersionRange -> Put Source # get :: Get VersionRange Source # putList :: [VersionRange] -> Put Source # | |
NFData VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal rnf :: VersionRange -> () Source # | |
Eq VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal (==) :: VersionRange -> VersionRange -> Bool # (/=) :: VersionRange -> VersionRange -> Bool # | |
Newtype (CompilerFlavor, VersionRange) TestedWith Source # | |
Defined in Distribution.FieldGrammar.Newtypes pack :: (CompilerFlavor, VersionRange) -> TestedWith Source # unpack :: TestedWith -> (CompilerFlavor, VersionRange) Source # | |
type Rep VersionRange Source # | |
Defined in Distribution.Types.VersionRange.Internal type Rep VersionRange = D1 ('MetaData "VersionRange" "Distribution.Types.VersionRange.Internal" "Cabal-3.6.0.0" 'False) (((C1 ('MetaCons "ThisVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version)) :+: C1 ('MetaCons "LaterVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version))) :+: (C1 ('MetaCons "OrLaterVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version)) :+: C1 ('MetaCons "EarlierVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version)))) :+: ((C1 ('MetaCons "OrEarlierVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version)) :+: C1 ('MetaCons "MajorBoundVersion" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version))) :+: (C1 ('MetaCons "UnionVersionRanges" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VersionRange) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VersionRange)) :+: C1 ('MetaCons "IntersectVersionRanges" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VersionRange) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 VersionRange))))) |
Constructing
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 < 0
.
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
Inspection
withinRange :: Version -> VersionRange -> Bool Source #
Does this version fall within the given range?
This is the evaluation function for the VersionRange
type.
:: a |
|
-> (Version -> a) | "== v" |
-> (Version -> a) | "> v" |
-> (Version -> a) | "< v" |
-> (a -> a -> a) |
|
-> (a -> a -> a) |
|
-> VersionRange | |
-> a |
Fold over the basic syntactic structure of a VersionRange
.
This provides a syntactic view of the expression defining the version range.
The syntactic sugar ">= v"
, "<= v"
and "== v.*"
is presented
in terms of the other basic syntax.
For a semantic view use asVersionIntervals
.
normaliseVersionRange :: VersionRange -> VersionRange Source #
Normalise VersionRange
.
In particular collapse (== v || > v)
into >= v
, and so on.
stripParensVersionRange :: VersionRange -> VersionRange Source #
Remove VersionRangeParens
constructors.
Since version 3.4 this function is id
, there aren't VersionRangeParens
constructor in VersionRange
anymore.
Since: Cabal-2.2
hasUpperBound :: VersionRange -> Bool Source #
Does the version range have an upper bound?
Since: Cabal-1.24.0.0
hasLowerBound :: VersionRange -> Bool Source #
Does the version range have an explicit lower bound?
Note: this function only considers the user-specified lower bounds, but not the implicit >=0 lower bound.
Since: Cabal-1.24.0.0
Cata & ana
data VersionRangeF a Source #
F-Algebra of VersionRange
. See cataVersionRange
.
Since: Cabal-2.2
ThisVersionF Version | |
LaterVersionF Version | |
OrLaterVersionF Version | |
EarlierVersionF Version | |
OrEarlierVersionF Version | |
MajorBoundVersionF Version | |
UnionVersionRangesF a a | |
IntersectVersionRangesF a a |
Instances
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
projectVersionRange :: VersionRange -> VersionRangeF VersionRange Source #
Since: Cabal-2.2
embedVersionRange :: VersionRangeF VersionRange -> VersionRange Source #
Since: Cabal-2.2
Utilities
isAnyVersion :: VersionRange -> Bool Source #
Does this VersionRange
place any restriction on the Version
or is it
in fact equivalent to AnyVersion
.
Note this is a semantic check, not simply a syntactic check. So for example
the following is True
(for all v
).
isAnyVersion (EarlierVersion v `UnionVersionRanges` orLaterVersion v)
isAnyVersionLight :: VersionRange -> Bool Source #
wildcardUpperBound :: Version -> Version Source #
Since: Cabal-2.2
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
versionRangeParser :: forall m. CabalParsing m => m Int -> CabalSpecVersion -> 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