Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type ReleaseTag = Text
- type SemVer = (Int, Int, Int, [ReleaseTag])
- data Wildcard
- data SemVerRange
- = Eq SemVer
- | Gt SemVer
- | Lt SemVer
- | Geq SemVer
- | Leq SemVer
- | And SemVerRange SemVerRange
- | Or SemVerRange SemVerRange
- versionsOf :: SemVerRange -> [SemVer]
- semver :: Int -> Int -> Int -> SemVer
- releaseTags :: SemVer -> [ReleaseTag]
- toTuple :: SemVer -> (Int, Int, Int)
- tuplesOf :: SemVerRange -> [(Int, Int, Int)]
- rangeReleaseTags :: SemVerRange -> [ReleaseTag]
- sharedReleaseTags :: SemVerRange -> Maybe [ReleaseTag]
- anyVersion :: SemVerRange
- renderSV :: SemVer -> Text
- renderSV' :: SemVer -> String
- matches :: SemVerRange -> SemVer -> Bool
- matchesSimple :: SemVerRange -> SemVer -> Bool
- matchesTags :: SemVerRange -> [ReleaseTag] -> [ReleaseTag] -> Bool
- bestMatch :: SemVerRange -> [SemVer] -> Either String SemVer
- wildcardToSemver :: Wildcard -> SemVer
- wildcardToRange :: Wildcard -> SemVerRange
- tildeToRange :: Wildcard -> SemVerRange
- caratToRange :: Wildcard -> SemVerRange
- hyphenatedRange :: Wildcard -> Wildcard -> SemVerRange
Documentation
type ReleaseTag = Text Source
type SemVer = (Int, Int, Int, [ReleaseTag]) Source
A SemVer has major, minor and patch versions, and zero or more pre-release version tags.
A partially specified semantic version. Implicitly defines
a range of acceptable versions, as seen in wildcardToRange
.
data SemVerRange Source
A range specifies bounds on a semver.
Eq SemVer | Exact equality |
Gt SemVer | Greater than |
Lt SemVer | Less than |
Geq SemVer | Greater than or equal to |
Leq SemVer | Less than or equal to |
And SemVerRange SemVerRange | Conjunction |
Or SemVerRange SemVerRange | Disjunction |
versionsOf :: SemVerRange -> [SemVer] Source
Pull all of the concrete versions out of a range.
releaseTags :: SemVer -> [ReleaseTag] Source
Get the release tags from a semver.
rangeReleaseTags :: SemVerRange -> [ReleaseTag] Source
Get all of the release tags from a version range.
sharedReleaseTags :: SemVerRange -> Maybe [ReleaseTag] Source
Get the range release tags if they're all the same; otherwise Nothing.
anyVersion :: SemVerRange Source
Satisfies any version.
matches :: SemVerRange -> SemVer -> Bool Source
Returns whether a given semantic version matches a range. Note that there are special cases when there are release tags. For detauls see https://github.com/npm/node-semver#prerelease-tags.
matchesSimple :: SemVerRange -> SemVer -> Bool Source
Simple predicate calculus matching, doing AND and OR combination with numerical comparison.
matchesTags :: SemVerRange -> [ReleaseTag] -> [ReleaseTag] -> Bool Source
Given a range and two sets of tags, the first being a bound on the second, uses the range to compare the tags and see if they match.
bestMatch :: SemVerRange -> [SemVer] -> Either String SemVer Source
Gets the highest-matching semver in a range.
wildcardToSemver :: Wildcard -> SemVer Source
Fills in zeros in a wildcard.
wildcardToRange :: Wildcard -> SemVerRange Source
Translates a wildcard (partially specified version) to a range. Ex: 2 := >=2.0.0 <3.0.0 Ex: 1.2.x := 1.2 := >=1.2.0 <1.3.0
tildeToRange :: Wildcard -> SemVerRange Source
Translates a ~wildcard to a range. Ex: ~1.2.3 := >=1.2.3 :==1.2.3 <1.3.0
caratToRange :: Wildcard -> SemVerRange Source
Translates a ^wildcard to a range. Ex: ^1.2.x := >=1.2.0 <2.0.0
hyphenatedRange :: Wildcard -> Wildcard -> SemVerRange Source
Translates two hyphenated wildcards to an actual range. Ex: 1.2.3 - 2.3.4 := >=1.2.3 <=2.3.4 Ex: 1.2 - 2.3.4 := >=1.2.0 <=2.3.4 Ex: 1.2.3 - 2 := >=1.2.3 <3.0.0