-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | An implementation of semver and semantic version ranges.
--
-- An implementation of semver and semantic version ranges.
@package semver-range
@version 0.1.0
module Data.SemVer
type ReleaseTag = Text
-- | A SemVer has major, minor and patch versions, and zero or more
-- pre-release version tags.
type SemVer = (Int, Int, Int, [ReleaseTag])
-- | A partially specified semantic version. Implicitly defines a range of
-- acceptable versions, as seen in wildcardToRange.
data Wildcard
Any :: Wildcard
One :: Int -> Wildcard
Two :: Int -> Int -> Wildcard
Three :: Int -> Int -> Int -> [Text] -> Wildcard
-- | A range specifies bounds on a semver.
data SemVerRange
-- | Exact equality
Eq :: SemVer -> SemVerRange
-- | Greater than
Gt :: SemVer -> SemVerRange
-- | Less than
Lt :: SemVer -> SemVerRange
-- | Greater than or equal to
Geq :: SemVer -> SemVerRange
-- | Less than or equal to
Leq :: SemVer -> SemVerRange
-- | Conjunction
And :: SemVerRange -> SemVerRange -> SemVerRange
-- | Disjunction
Or :: SemVerRange -> SemVerRange -> SemVerRange
-- | Pull all of the concrete versions out of a range.
versionsOf :: SemVerRange -> [SemVer]
-- | Create a SemVer with no version tags.
semver :: Int -> Int -> Int -> SemVer
-- | Get the release tags from a semver.
releaseTags :: SemVer -> [ReleaseTag]
-- | Get only the version tuple from a semver.
toTuple :: SemVer -> (Int, Int, Int)
-- | Get a list of tuples from a version range.
tuplesOf :: SemVerRange -> [(Int, Int, Int)]
-- | Get all of the release tags from a version range.
rangeReleaseTags :: SemVerRange -> [ReleaseTag]
-- | Satisfies any version.
anyVersion :: SemVerRange
-- | Render a semver as Text.
renderSV :: SemVer -> Text
-- | Render a semver as a String.
renderSV' :: SemVer -> String
-- | 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.
matches :: SemVerRange -> SemVer -> Bool
-- | Simple predicate calculus matching, doing AND and OR combination with
-- numerical comparison.
matchesSimple :: SemVerRange -> SemVer -> Bool
-- | 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.
matchesTags :: SemVerRange -> [ReleaseTag] -> [ReleaseTag] -> Bool
-- | Gets the highest-matching semver in a range.
bestMatch :: SemVerRange -> [SemVer] -> Either String SemVer
-- | Fills in zeros in a wildcard.
wildcardToSemver :: Wildcard -> SemVer
-- | 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
wildcardToRange :: Wildcard -> SemVerRange
-- | Translates a ~wildcard to a range. Ex: ~1.2.3 := >=1.2.3
-- :==1.2.3 <1.3.0
tildeToRange :: Wildcard -> SemVerRange
-- | Translates a ^wildcard to a range. Ex: ^1.2.x := >=1.2.0 <2.0.0
caratToRange :: Wildcard -> SemVerRange
-- | 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
hyphenatedRange :: Wildcard -> Wildcard -> SemVerRange
instance GHC.Classes.Ord Data.SemVer.SemVerRange
instance GHC.Classes.Eq Data.SemVer.SemVerRange
instance GHC.Classes.Eq Data.SemVer.Wildcard
instance GHC.Show.Show Data.SemVer.Wildcard
instance GHC.Show.Show Data.SemVer.SemVerRange
module Data.SemVer.Parser
-- | Parse a string as an explicit version, or return an error.
parseSemVer :: Text -> Either ParseError SemVer
-- | Parse a string as a version range, or return an error.
parseSemVerRange :: Text -> Either ParseError SemVerRange
-- | Top-level parser. Parses a semantic version range.
pSemVerRange :: Parser SemVerRange
-- | Parses a semantic version.
pSemVer :: Parser SemVer
-- | Parse a semver from a haskell version. There must be exactly three
-- numbers in the versionBranch field.
fromHaskellVersion :: Version -> Either Text SemVer