semver-range-0.1.1: An implementation of semver and semantic version ranges.

Safe HaskellNone
LanguageHaskell2010

Data.SemVer

Synopsis

Documentation

type SemVer = (Int, Int, Int, [ReleaseTag]) Source

A SemVer has major, minor and patch versions, and zero or more pre-release version tags.

data Wildcard Source

A partially specified semantic version. Implicitly defines a range of acceptable versions, as seen in wildcardToRange.

Constructors

Any 
One Int 
Two Int Int 
Three Int Int Int [Text] 

data SemVerRange Source

A range specifies bounds on a semver.

Constructors

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.

semver :: Int -> Int -> Int -> SemVer Source

Create a SemVer with no version tags.

releaseTags :: SemVer -> [ReleaseTag] Source

Get the release tags from a semver.

toTuple :: SemVer -> (Int, Int, Int) Source

Get only the version tuple from a semver.

tuplesOf :: SemVerRange -> [(Int, Int, Int)] Source

Get a list of tuples from a version range.

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.

renderSV :: SemVer -> Text Source

Render a semver as Text.

renderSV' :: SemVer -> String Source

Render a semver as a String.

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