semver-range-0.2.8: 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 # 
Instance details

Defined in Data.SemVer.Types

Ord PrereleaseTag Source # 
Instance details

Defined in Data.SemVer.Types

Show PrereleaseTag Source # 
Instance details

Defined in Data.SemVer.Types

IsString PrereleaseTag Source # 
Instance details

Defined in Data.SemVer.Types

Generic PrereleaseTag Source # 
Instance details

Defined in Data.SemVer.Types

Associated Types

type Rep PrereleaseTag :: Type -> Type #

Hashable PrereleaseTag Source # 
Instance details

Defined in Data.SemVer.Types

type Rep PrereleaseTag Source # 
Instance details

Defined in Data.SemVer.Types

type Rep PrereleaseTag = D1 (MetaData "PrereleaseTag" "Data.SemVer.Types" "semver-range-0.2.8-EUE4datnY94FUOjpW514FG" False) (C1 (MetaCons "IntTag" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)) :+: C1 (MetaCons "TextTag" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

newtype PrereleaseTags Source #

Instances
IsList PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

Associated Types

type Item PrereleaseTags :: Type #

Eq PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

Ord PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

Show PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

Generic PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

Associated Types

type Rep PrereleaseTags :: Type -> Type #

Semigroup PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

Monoid PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

Hashable PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

type Rep PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

type Rep PrereleaseTags = D1 (MetaData "PrereleaseTags" "Data.SemVer.Types" "semver-range-0.2.8-EUE4datnY94FUOjpW514FG" True) (C1 (MetaCons "PrereleaseTags" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [PrereleaseTag])))
type Item PrereleaseTags Source # 
Instance details

Defined in Data.SemVer.Types

data SemVer Source #

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

Instances
Eq SemVer Source # 
Instance details

Defined in Data.SemVer.Types

Methods

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

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

Ord SemVer Source #

Define an Ord instance which ignores the buildMetaData.

Instance details

Defined in Data.SemVer.Types

Show SemVer Source # 
Instance details

Defined in Data.SemVer.Types

Generic SemVer Source # 
Instance details

Defined in Data.SemVer.Types

Associated Types

type Rep SemVer :: Type -> Type #

Methods

from :: SemVer -> Rep SemVer x #

to :: Rep SemVer x -> SemVer #

Hashable SemVer Source # 
Instance details

Defined in Data.SemVer.Types

Methods

hashWithSalt :: Int -> SemVer -> Int #

hash :: SemVer -> Int #

type Rep SemVer Source # 
Instance details

Defined in Data.SemVer.Types

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.