Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
WARNING: This module should be considered private! If you find yourself wanting to import something from this module, please open an issue to get that thing exported from Salve.
Synopsis
- data Version = Version {}
- data PreRelease
- newtype Build = Build String
- data Constraint
- makeVersion :: Word64 -> Word64 -> Word64 -> [PreRelease] -> [Build] -> Version
- initialVersion :: Version
- parseVersion :: String -> Maybe Version
- parsePreRelease :: String -> Maybe PreRelease
- parseBuild :: String -> Maybe Build
- parseConstraint :: String -> Maybe Constraint
- unsafeParseVersion :: String -> Version
- unsafeParsePreRelease :: String -> PreRelease
- unsafeParseBuild :: String -> Build
- unsafeParseConstraint :: String -> Constraint
- renderVersion :: Version -> String
- renderPreRelease :: PreRelease -> String
- renderBuild :: Build -> String
- renderConstraint :: Constraint -> String
- isUnstable :: Version -> Bool
- isStable :: Version -> Bool
- fromBaseVersion :: Version -> Version
- toBaseVersion :: Version -> Version
- bumpMajor :: Version -> Version
- bumpMinor :: Version -> Version
- bumpPatch :: Version -> Version
- satisfiesConstraint :: Constraint -> Version -> Bool
- majorLens :: Functor f => (Word64 -> f Word64) -> Version -> f Version
- minorLens :: Functor f => (Word64 -> f Word64) -> Version -> f Version
- patchLens :: Functor f => (Word64 -> f Word64) -> Version -> f Version
- preReleasesLens :: Functor f => ([PreRelease] -> f [PreRelease]) -> Version -> f Version
- buildsLens :: Functor f => ([Build] -> f [Build]) -> Version -> f Version
- data Operator
- data Wildcard
- constraintLT :: Version -> Constraint
- constraintLE :: Version -> Constraint
- constraintEQ :: Version -> Constraint
- constraintGE :: Version -> Constraint
- constraintGT :: Version -> Constraint
- constraintAnd :: Constraint -> Constraint -> Constraint
- constraintOr :: Constraint -> Constraint -> Constraint
- constraintHyphen :: Version -> Version -> Constraint
- constraintTilde :: Version -> Constraint
- constraintCaret :: Version -> Constraint
Documentation
A semantic version number. Versions have five parts:
majorLens
: The major version number.minorLens
: The minor version number.patchLens
: The patch version number.preReleasesLens
: A list of pre-release identifiers.buildsLens
: A list of build metadata.
Use parseVersion
to create versions.
Version | |
|
Instances
Eq Version Source # | |
Data Version Source # | |
Defined in Salve.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Version -> c Version # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Version # toConstr :: Version -> Constr # dataTypeOf :: Version -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Version) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Version) # gmapT :: (forall b. Data b => b -> b) -> Version -> Version # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Version -> r # gmapQ :: (forall d. Data d => d -> u) -> Version -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Version -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Version -> m Version # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Version -> m Version # | |
Ord Version Source # | In general, versions compare in the way that you would expect. First the major version numbers are compared, then the minors, then the patches.
Numbers are compared numerically, not alphabetically.
If all the numbers are the same, the pre-releases are compared.
A version with a pre-release is always less than a version without one as long as the other parts are the same.
Builds are not considered when comparing versions.
|
Read Version Source # | |
Show Version Source # | |
Generic Version Source # | |
type Rep Version Source # | |
Defined in Salve.Internal type Rep Version = D1 (MetaData "Version" "Salve.Internal" "salve-1.0.10-CS6HqfWAQu5RpiFvSg5on" False) (C1 (MetaCons "Version" PrefixI True) ((S1 (MetaSel (Just "versionMajor") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64) :*: S1 (MetaSel (Just "versionMinor") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64)) :*: (S1 (MetaSel (Just "versionPatch") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64) :*: (S1 (MetaSel (Just "versionPreReleases") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [PreRelease]) :*: S1 (MetaSel (Just "versionBuilds") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Build]))))) |
data PreRelease Source #
Pre-release information attached to a version. These can either be numeric or textual. They must not be empty.
- Numeric: Can be any non-negative integer. Cannot have leading zeros.
- Textual: Can be any string of ASCII digits, letters, or hyphens. Cannot be all digits, as that would be numeric.
In general, pre-releases must match the regular expression
/^[-0-9A-Za-z]+$/
.
Use parsePreRelease
to create pre-releases.
Instances
Eq PreRelease Source # | |
Defined in Salve.Internal (==) :: PreRelease -> PreRelease -> Bool # (/=) :: PreRelease -> PreRelease -> Bool # | |
Data PreRelease Source # | |
Defined in Salve.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> PreRelease -> c PreRelease # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c PreRelease # toConstr :: PreRelease -> Constr # dataTypeOf :: PreRelease -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c PreRelease) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c PreRelease) # gmapT :: (forall b. Data b => b -> b) -> PreRelease -> PreRelease # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> PreRelease -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> PreRelease -> r # gmapQ :: (forall d. Data d => d -> u) -> PreRelease -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> PreRelease -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> PreRelease -> m PreRelease # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> PreRelease -> m PreRelease # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> PreRelease -> m PreRelease # | |
Ord PreRelease Source # | Numeric pre-releases are always less than textual pre-releases.
Numeric pre-releases are compared numerically.
Textual pre-releases are compared alphabetically.
|
Defined in Salve.Internal compare :: PreRelease -> PreRelease -> Ordering # (<) :: PreRelease -> PreRelease -> Bool # (<=) :: PreRelease -> PreRelease -> Bool # (>) :: PreRelease -> PreRelease -> Bool # (>=) :: PreRelease -> PreRelease -> Bool # max :: PreRelease -> PreRelease -> PreRelease # min :: PreRelease -> PreRelease -> PreRelease # | |
Read PreRelease Source # | |
Defined in Salve.Internal readsPrec :: Int -> ReadS PreRelease # readList :: ReadS [PreRelease] # readPrec :: ReadPrec PreRelease # readListPrec :: ReadPrec [PreRelease] # | |
Show PreRelease Source # | |
Defined in Salve.Internal showsPrec :: Int -> PreRelease -> ShowS # show :: PreRelease -> String # showList :: [PreRelease] -> ShowS # | |
Generic PreRelease Source # | |
Defined in Salve.Internal type Rep PreRelease :: Type -> Type # from :: PreRelease -> Rep PreRelease x # to :: Rep PreRelease x -> PreRelease # | |
type Rep PreRelease Source # | |
Defined in Salve.Internal type Rep PreRelease = D1 (MetaData "PreRelease" "Salve.Internal" "salve-1.0.10-CS6HqfWAQu5RpiFvSg5on" False) (C1 (MetaCons "PreReleaseNumeric" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64)) :+: C1 (MetaCons "PreReleaseTextual" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 String))) |
Build metadata attached to a version. These are similar to
PreRelease
s with some key differences:
- There is no such thing as numeric builds. Even though builds can look like numbers, all builds are textual.
- As a result, builds that look numeric are allowed to have leading zeros.
- Builds cannot be compared. That is, they do not have an
Ord
instance.
Use parseBuild
to create builds.
Instances
Eq Build Source # | |
Data Build Source # | |
Defined in Salve.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Build -> c Build # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Build # dataTypeOf :: Build -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Build) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Build) # gmapT :: (forall b. Data b => b -> b) -> Build -> Build # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Build -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Build -> r # gmapQ :: (forall d. Data d => d -> u) -> Build -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Build -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Build -> m Build # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Build -> m Build # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Build -> m Build # | |
Read Build Source # | |
Show Build Source # | |
Generic Build Source # | |
type Rep Build Source # | |
Defined in Salve.Internal |
data Constraint Source #
Constrains allowable version numbers.
Use parseConstraint
to create constraints and satisfiesConstraint
to see
if a version number satisfies a constraint.
ConstraintOperator Operator Version | |
ConstraintHyphen Version Version | |
ConstraintWildcard Wildcard | |
ConstraintAnd Constraint Constraint | |
ConstraintOr Constraint Constraint |
Instances
makeVersion :: Word64 -> Word64 -> Word64 -> [PreRelease] -> [Build] -> Version Source #
Makes a new version number.
>>>
makeVersion 1 2 3 [unsafeParsePreRelease "pre"] [unsafeParseBuild "build"]
Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [PreReleaseTextual "pre"], versionBuilds = [Build "build"]}
This can be a useful alternative to parseVersion
if you want a total way
to create a version.
initialVersion :: Version Source #
The initial version number for development.
>>>
initialVersion
Version {versionMajor = 0, versionMinor = 0, versionPatch = 0, versionPreReleases = [], versionBuilds = []}
parseVersion :: String -> Maybe Version Source #
Attempts to parse a version. This parser follows SemVer's BNF.
>>>
parseVersion "1.2.3-p.4+b.5"
Just (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [PreReleaseTextual "p",PreReleaseNumeric 4], versionBuilds = [Build "b",Build "5"]})
Returns Nothing
if the parse fails.
>>>
parseVersion "wrong"
Nothing
Whitespace is allowed.
>>>
parseVersion " 1.2.3 "
Just (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})
parsePreRelease :: String -> Maybe PreRelease Source #
Attempts to parse a pre-release.
>>>
parsePreRelease "pre"
Just (PreReleaseTextual "pre")>>>
parsePreRelease "1"
Just (PreReleaseNumeric 1)
Returns Nothing
if the parse fails.
>>>
parsePreRelease "wrong!"
Nothing
Numeric pre-releases cannot contain leading zeros.
>>>
parsePreRelease "01"
Nothing
parseBuild :: String -> Maybe Build Source #
Attempts to parse a build.
>>>
parseBuild "build"
Just (Build "build")>>>
parseBuild "1"
Just (Build "1")
Returns Nothing
if the parse fails.
>>>
parseBuild "wrong!"
Nothing
Unlike pre-releases, numeric builds can have leading zeros.
>>>
parseBuild "01"
Just (Build "01")
parseConstraint :: String -> Maybe Constraint Source #
Attempts to parse a constraint. This parser mostly follows npm's BNF.
>>>
parseConstraint ">1.2.3"
Just (ConstraintOperator OperatorGT (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))
Returns Nothing
if the parse fails.
>>>
parseConstraint "wrong"
Nothing
The two departures from npm's BNF are that x-ranges cannot be used with other operators and partial version numbers are not allowed.
>>>
parseConstraint "1.2.x"
Just (ConstraintWildcard (WildcardPatch 1 2))>>>
parseConstraint ">=1.2.x"
Nothing
>>>
parseConstraint "1.2"
Nothing>>>
parseConstraint ">=1.2"
Nothing
unsafeParseVersion :: String -> Version Source #
Parses a version.
>>>
unsafeParseVersion "1.2.3-p.4+b.5"
Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [PreReleaseTextual "p",PreReleaseNumeric 4], versionBuilds = [Build "b",Build "5"]}
Raises an exception if the parse fails.
>>>
unsafeParseVersion "wrong"
*** Exception: unsafeParseVersion: invalid version: "wrong" ...
See parseVersion
for a safe version of this function.
unsafeParsePreRelease :: String -> PreRelease Source #
Parses a pre-release.
>>>
unsafeParsePreRelease "pre"
PreReleaseTextual "pre"
Raises an exception if the parse fails.
>>>
unsafeParsePreRelease "wrong!"
*** Exception: unsafeParsePreRelease: invalid pre-release: "wrong!" ...
See parsePreRelease
for a safe version of this function.
unsafeParseBuild :: String -> Build Source #
Parses a build.
>>>
unsafeParseBuild "build"
Build "build"
Raises an exception if the parse fails.
>>>
unsafeParseBuild "wrong!"
Build "*** Exception: unsafeParseBuild: invalid build: "wrong!" ...
See parseBuild
for a safe version of this function.
unsafeParseConstraint :: String -> Constraint Source #
Parses a constraint.
>>>
unsafeParseConstraint ">1.2.3"
ConstraintOperator OperatorGT (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})
Raises an exception if the parse fails.
>>>
unsafeParseConstraint "wrong"
*** Exception: unsafeParseConstraint: invalid constraint: "wrong" ...
See parseConstraint
for a safe version of this function.
renderVersion :: Version -> String Source #
Renders a version.
>>>
renderVersion <$> parseVersion "1.2.3-p.4+b.5"
Just "1.2.3-p.4+b.5"
renderPreRelease :: PreRelease -> String Source #
Renders a pre-release.
>>>
renderPreRelease <$> parsePreRelease "pre"
Just "pre">>>
renderPreRelease <$> parsePreRelease "1"
Just "1"
renderBuild :: Build -> String Source #
Renders a build.
>>>
renderBuild <$> parseBuild "build"
Just "build">>>
renderBuild <$> parseBuild "1"
Just "1"
renderConstraint :: Constraint -> String Source #
Renders a constraint.
>>>
renderConstraint <$> parseConstraint ">1.2.3"
Just ">1.2.3"
Parsing and rendering a constraint doesn't always return what you started with.
>>>
renderConstraint <$> parseConstraint "=1.2.3"
Just "1.2.3"
isUnstable :: Version -> Bool Source #
fromBaseVersion :: Version -> Version Source #
Converts from a Version
from the base
package.
>>>
renderVersion . fromBaseVersion $ Version.makeVersion [1, 2, 3]
"1.2.3"
Missing version components are set to zero.
>>>
renderVersion . fromBaseVersion $ Version.makeVersion []
"0.0.0">>>
renderVersion . fromBaseVersion $ Version.makeVersion [1]
"1.0.0">>>
renderVersion . fromBaseVersion $ Version.makeVersion [1, 2]
"1.2.0"
Extra version components are ignored.
>>>
renderVersion . fromBaseVersion $ Version.makeVersion [1, 2, 3, 4]
"1.2.3"
Tags are ignored.
>>>
renderVersion . fromBaseVersion $ Version.Version [] ["ignored"]
"0.0.0"
toBaseVersion :: Version -> Version Source #
Converts to a Version
from the base
package.
>>>
toBaseVersion <$> parseVersion "1.2.3"
Just (Version {versionBranch = [1,2,3], versionTags = []})
Pre-releases and builds are converted to tags.
>>>
toBaseVersion <$> parseVersion "1.2.3-pre+build"
Just (Version {versionBranch = [1,2,3], versionTags = ["pre","build"]})
bumpMajor :: Version -> Version Source #
Increments the major version number.
>>>
bumpMajor <$> parseVersion "0.0.0"
Just (Version {versionMajor = 1, versionMinor = 0, versionPatch = 0, versionPreReleases = [], versionBuilds = []})
The minor and patch numbers are reset to zero.
>>>
bumpMajor <$> parseVersion "1.2.3"
Just (Version {versionMajor = 2, versionMinor = 0, versionPatch = 0, versionPreReleases = [], versionBuilds = []})
The pre-releases and builds are removed.
>>>
bumpMajor <$> parseVersion "0.0.0-pre+build"
Just (Version {versionMajor = 1, versionMinor = 0, versionPatch = 0, versionPreReleases = [], versionBuilds = []})
Consider using majorLens
if you want to arbitrarily change the major
number, or if you don't want the other parts of the version to change.
bumpMinor :: Version -> Version Source #
Increments the minor version number.
>>>
bumpMinor <$> parseVersion "0.0.0"
Just (Version {versionMajor = 0, versionMinor = 1, versionPatch = 0, versionPreReleases = [], versionBuilds = []})
The patch number is reset to zero.
>>>
bumpMinor <$> parseVersion "1.2.3"
Just (Version {versionMajor = 1, versionMinor = 3, versionPatch = 0, versionPreReleases = [], versionBuilds = []})
The pre-releases and builds are removed.
>>>
bumpMinor <$> parseVersion "0.0.0-pre+build"
Just (Version {versionMajor = 0, versionMinor = 1, versionPatch = 0, versionPreReleases = [], versionBuilds = []})
Consider using minorLens
if you want to arbitrarily change the minor
number, or if you don't want the other parts of the version to change.
bumpPatch :: Version -> Version Source #
Increments the patch number.
>>>
bumpPatch <$> parseVersion "0.0.0"
Just (Version {versionMajor = 0, versionMinor = 0, versionPatch = 1, versionPreReleases = [], versionBuilds = []})
The major and minor numbers are not changed.
>>>
bumpPatch <$> parseVersion "1.2.3"
Just (Version {versionMajor = 1, versionMinor = 2, versionPatch = 4, versionPreReleases = [], versionBuilds = []})
The pre-releases and builds are removed.
>>>
bumpPatch <$> parseVersion "0.0.0-pre+build"
Just (Version {versionMajor = 0, versionMinor = 0, versionPatch = 1, versionPreReleases = [], versionBuilds = []})
Consider using patchLens
if you want to arbitrarily change the patch
number, or if you don't want the other parts of the version to change.
satisfiesConstraint :: Constraint -> Version -> Bool Source #
majorLens :: Functor f => (Word64 -> f Word64) -> Version -> f Version Source #
Focuses on the major version number.
>>>
view majorLens <$> parseVersion "1.2.3-pre.4+build.5"
Just 1>>>
set majorLens 4 <$> parseVersion "1.2.3"
Just (Version {versionMajor = 4, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})
minorLens :: Functor f => (Word64 -> f Word64) -> Version -> f Version Source #
Focuses on the minor version number.
>>>
view minorLens <$> parseVersion "1.2.3-pre.4+build.5"
Just 2>>>
set minorLens 4 <$> parseVersion "1.2.3"
Just (Version {versionMajor = 1, versionMinor = 4, versionPatch = 3, versionPreReleases = [], versionBuilds = []})
patchLens :: Functor f => (Word64 -> f Word64) -> Version -> f Version Source #
Focuses on the patch version number.
>>>
view patchLens <$> parseVersion "1.2.3-pre.4+build.5"
Just 3>>>
set patchLens 4 <$> parseVersion "1.2.3"
Just (Version {versionMajor = 1, versionMinor = 2, versionPatch = 4, versionPreReleases = [], versionBuilds = []})
preReleasesLens :: Functor f => ([PreRelease] -> f [PreRelease]) -> Version -> f Version Source #
Focuses on the pre-release identifiers.
>>>
view preReleasesLens <$> parseVersion "1.2.3-pre.4+build.5"
Just [PreReleaseTextual "pre",PreReleaseNumeric 4]>>>
set preReleasesLens [] <$> parseVersion "1.2.3-pre"
Just (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})
buildsLens :: Functor f => ([Build] -> f [Build]) -> Version -> f Version Source #
Focuses on the build metadata.
>>>
view buildsLens <$> parseVersion "1.2.3-pre.4+build.5"
Just [Build "build",Build "5"]>>>
set buildsLens [] <$> parseVersion "1.2.3+build"
Just (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})
Instances
Eq Operator Source # | |
Data Operator Source # | |
Defined in Salve.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Operator -> c Operator # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Operator # toConstr :: Operator -> Constr # dataTypeOf :: Operator -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Operator) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Operator) # gmapT :: (forall b. Data b => b -> b) -> Operator -> Operator # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Operator -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Operator -> r # gmapQ :: (forall d. Data d => d -> u) -> Operator -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Operator -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Operator -> m Operator # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Operator -> m Operator # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Operator -> m Operator # | |
Ord Operator Source # | |
Defined in Salve.Internal | |
Read Operator Source # | |
Show Operator Source # | |
Generic Operator Source # | |
type Rep Operator Source # | |
Defined in Salve.Internal type Rep Operator = D1 (MetaData "Operator" "Salve.Internal" "salve-1.0.10-CS6HqfWAQu5RpiFvSg5on" False) ((C1 (MetaCons "OperatorLT" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "OperatorLE" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "OperatorEQ" PrefixI False) (U1 :: Type -> Type))) :+: ((C1 (MetaCons "OperatorGE" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "OperatorGT" PrefixI False) (U1 :: Type -> Type)) :+: (C1 (MetaCons "OperatorTilde" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "OperatorCaret" PrefixI False) (U1 :: Type -> Type)))) |
Instances
Eq Wildcard Source # | |
Data Wildcard Source # | |
Defined in Salve.Internal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Wildcard -> c Wildcard # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Wildcard # toConstr :: Wildcard -> Constr # dataTypeOf :: Wildcard -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Wildcard) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Wildcard) # gmapT :: (forall b. Data b => b -> b) -> Wildcard -> Wildcard # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Wildcard -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Wildcard -> r # gmapQ :: (forall d. Data d => d -> u) -> Wildcard -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Wildcard -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Wildcard -> m Wildcard # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Wildcard -> m Wildcard # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Wildcard -> m Wildcard # | |
Ord Wildcard Source # | |
Defined in Salve.Internal | |
Read Wildcard Source # | |
Show Wildcard Source # | |
Generic Wildcard Source # | |
type Rep Wildcard Source # | |
Defined in Salve.Internal type Rep Wildcard = D1 (MetaData "Wildcard" "Salve.Internal" "salve-1.0.10-CS6HqfWAQu5RpiFvSg5on" False) (C1 (MetaCons "WildcardMajor" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "WildcardMinor" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64)) :+: C1 (MetaCons "WildcardPatch" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Word64)))) |
constraintLT :: Version -> Constraint Source #
Makes a new constraint that must be less than the version number.
>>>
constraintLT <$> parseVersion "1.2.3"
Just (ConstraintOperator OperatorLT (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))>>>
parseConstraint "<1.2.3"
Just (ConstraintOperator OperatorLT (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))
constraintLE :: Version -> Constraint Source #
Makes a new constraint that must be less than or euqal to the version number.
>>>
constraintLE <$> parseVersion "1.2.3"
Just (ConstraintOperator OperatorLE (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))>>>
parseConstraint "<=1.2.3"
Just (ConstraintOperator OperatorLE (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))
constraintEQ :: Version -> Constraint Source #
Makes a new constraint that must be equal to the version number.
>>>
constraintEQ <$> parseVersion "1.2.3"
Just (ConstraintOperator OperatorEQ (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))>>>
parseConstraint "=1.2.3"
Just (ConstraintOperator OperatorEQ (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))
constraintGE :: Version -> Constraint Source #
Makes a new constraint that must be greater than or equal to the version number.
>>>
constraintGE <$> parseVersion "1.2.3"
Just (ConstraintOperator OperatorGE (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))>>>
parseConstraint ">=1.2.3"
Just (ConstraintOperator OperatorGE (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))
constraintGT :: Version -> Constraint Source #
Makes a new constraint that must be greater than the version number.
>>>
constraintGT <$> parseVersion "1.2.3"
Just (ConstraintOperator OperatorGT (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))>>>
parseConstraint ">1.2.3"
Just (ConstraintOperator OperatorGT (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))
constraintAnd :: Constraint -> Constraint -> Constraint Source #
Makes a new constraint that must satisfy both constraints.
>>>
constraintAnd <$> (constraintGE <$> parseVersion "1.2.3") <*> (constraintLT <$> parseVersion "2.0.0")
Just (ConstraintAnd (ConstraintOperator OperatorGE (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})) (ConstraintOperator OperatorLT (Version {versionMajor = 2, versionMinor = 0, versionPatch = 0, versionPreReleases = [], versionBuilds = []})))>>>
parseConstraint ">=1.2.3 <2.0.0"
Just (ConstraintAnd (ConstraintOperator OperatorGE (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})) (ConstraintOperator OperatorLT (Version {versionMajor = 2, versionMinor = 0, versionPatch = 0, versionPreReleases = [], versionBuilds = []})))
constraintOr :: Constraint -> Constraint -> Constraint Source #
Makes a new constraint that must satisfy either constraint.
>>>
constraintOr <$> (constraintEQ <$> parseVersion "1.2.3") <*> (constraintGT <$> parseVersion "1.2.3")
Just (ConstraintOr (ConstraintOperator OperatorEQ (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})) (ConstraintOperator OperatorGT (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})))>>>
parseConstraint "=1.2.3 || >1.2.3"
Just (ConstraintOr (ConstraintOperator OperatorEQ (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})) (ConstraintOperator OperatorGT (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []})))
constraintHyphen :: Version -> Version -> Constraint Source #
Makes a new constraint that must be between the versions, inclusive.
>>>
constraintHyphen <$> parseVersion "1.2.3" <*> parseVersion "2.3.4"
Just (ConstraintHyphen (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}) (Version {versionMajor = 2, versionMinor = 3, versionPatch = 4, versionPreReleases = [], versionBuilds = []}))>>>
parseConstraint "1.2.3 - 2.3.4"
Just (ConstraintHyphen (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}) (Version {versionMajor = 2, versionMinor = 3, versionPatch = 4, versionPreReleases = [], versionBuilds = []}))
constraintTilde :: Version -> Constraint Source #
Makes a new constraint that allows changes to the patch version number.
>>>
constraintTilde <$> parseVersion "1.2.3"
Just (ConstraintOperator OperatorTilde (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))>>>
parseConstraint "~1.2.3"
Just (ConstraintOperator OperatorTilde (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))
constraintCaret :: Version -> Constraint Source #
Makes a new constraint that allows changes that do not modify the left-most non-zero version number.
>>>
constraintCaret <$> parseVersion "1.2.3"
Just (ConstraintOperator OperatorCaret (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))>>>
parseConstraint "^1.2.3"
Just (ConstraintOperator OperatorCaret (Version {versionMajor = 1, versionMinor = 2, versionPatch = 3, versionPreReleases = [], versionBuilds = []}))