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

Safe HaskellNone
LanguageHaskell2010

Data.SemVer

Synopsis

Documentation

data PrereleaseTag Source #

Prerelease tags can either be numbers or text.

Constructors

IntTag Int 
TextTag Text 

Instances

Eq PrereleaseTag Source # 
Ord PrereleaseTag Source # 
Show PrereleaseTag Source # 
IsString PrereleaseTag Source # 
Generic PrereleaseTag Source # 

Associated Types

type Rep PrereleaseTag :: * -> * #

Hashable PrereleaseTag Source # 
type Rep PrereleaseTag Source # 
type Rep PrereleaseTag = D1 * (MetaData "PrereleaseTag" "Data.SemVer.Types" "semver-range-0.2.7-9qO3uE4tsbP2Mv3UOsmFBZ" False) ((:+:) * (C1 * (MetaCons "IntTag" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Int))) (C1 * (MetaCons "TextTag" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Text))))

newtype PrereleaseTags Source #

Instances

IsList PrereleaseTags Source # 
Eq PrereleaseTags Source # 
Ord PrereleaseTags Source # 
Show PrereleaseTags Source # 
Generic PrereleaseTags Source # 

Associated Types

type Rep PrereleaseTags :: * -> * #

Monoid PrereleaseTags Source # 
Hashable PrereleaseTags Source # 
type Rep PrereleaseTags Source # 
type Rep PrereleaseTags = D1 * (MetaData "PrereleaseTags" "Data.SemVer.Types" "semver-range-0.2.7-9qO3uE4tsbP2Mv3UOsmFBZ" True) (C1 * (MetaCons "PrereleaseTags" PrefixI False) (S1 * (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * [PrereleaseTag])))
type Item PrereleaseTags Source # 

data SemVer Source #

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

Instances

Eq SemVer Source # 

Methods

(==) :: SemVer -> SemVer -> Bool #

(/=) :: SemVer -> SemVer -> Bool #

Ord SemVer Source #

Define an Ord instance which ignores the buildMetaData.

Show SemVer Source # 
Generic SemVer Source # 

Associated Types

type Rep SemVer :: * -> * #

Methods

from :: SemVer -> Rep SemVer x #

to :: Rep SemVer x -> SemVer #

Hashable SemVer Source # 

Methods

hashWithSalt :: Int -> SemVer -> Int #

hash :: SemVer -> Int #

type Rep SemVer Source # 

data SemVerRange Source #

A range specifies bounds on a semver.

Constructors

Eq SemVer infixl 4

Exact equality

Gt SemVer infixl 4

Greater than

Lt SemVer infixl 4

Less than

Geq SemVer infixl 4

Greater than or equal to

Leq SemVer infixl 4

Less than or equal to

And SemVerRange SemVerRange infixl 3

Conjunction

Or SemVerRange SemVerRange infixl 3

Disjunction

versionsOf :: SemVerRange -> [SemVer] Source #

Pull all of the concrete versions out of a range.

stripRangeTags :: SemVerRange -> SemVerRange Source #

Strip out all prerelease tags from a given SemVerRange.

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

Create a SemVer with no version tags.

semver' :: Int -> Int -> Int -> PrereleaseTags -> SemVer Source #

Create a SemVer with tags

semver'' :: Int -> Int -> Int -> PrereleaseTags -> BuildMetaData -> SemVer Source #

Create a SemVer with tags and metadata.

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.

rangePrereleaseTags :: SemVerRange -> PrereleaseTags Source #

Get all of the prerelease tags from a version range.

sharedTags :: SemVerRange -> Maybe PrereleaseTags Source #

Get the range prerelease tags if they're all the same; otherwise Nothing.

anyVersion :: SemVerRange Source #

Satisfies any version.

renderSV :: SemVer -> Text Source #

Render a semver as Text.

matches :: SemVerRange -> SemVer -> Bool infixl 2 Source #

Returns whether a given semantic version matches a range. Note that there are special cases when there are prerelease tags. For details 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 -> PrereleaseTags -> PrereleaseTags -> 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.

parseSemVer :: Text -> Either ParseError SemVer Source #

Parse a string as an explicit version, or return an error.

parseSemVerRange :: Text -> Either ParseError SemVerRange Source #

Parse a string as a version range, or return an error.

pSemVerRange :: Parser SemVerRange Source #

Top-level parser. Parses a semantic version range.

pSemVer :: Parser SemVer Source #

Parses a semantic version.

fromHaskellVersion :: Version -> Either Text SemVer Source #

Parse a semver from a haskell version. There must be exactly three numbers in the versionBranch field.

matchText :: Text -> Text -> Either Text Bool Source #

Parses the first argument as a range and the second argument as a semver, and returns whether they match.

splitWS :: Text -> [Text] Source #

Split a text on whitespace. Why isn't this in the stdlib.