-- 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.2.7 module Data.SemVer -- | Prerelease tags can either be numbers or text. data PrereleaseTag IntTag :: Int -> PrereleaseTag TextTag :: Text -> PrereleaseTag newtype PrereleaseTags PrereleaseTags :: [PrereleaseTag] -> PrereleaseTags type BuildMetaData = [Text] -- | A SemVer has major, minor and patch versions, and zero or more -- pre-release version tags. data SemVer SemVer :: !Int -> !Int -> !Int -> !PrereleaseTags -> !BuildMetaData -> SemVer [svMajor] :: SemVer -> !Int [svMinor] :: SemVer -> !Int [svPatch] :: SemVer -> !Int [svTags] :: SemVer -> !PrereleaseTags [svBuildMetadata] :: SemVer -> !BuildMetaData -- | Define an Ord instance which ignores the buildMetaData. -- | 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] -- | Strip out all prerelease tags from a given SemVerRange. stripRangeTags :: SemVerRange -> SemVerRange -- | Create a SemVer with no version tags. semver :: Int -> Int -> Int -> SemVer -- | Create a SemVer with tags semver' :: Int -> Int -> Int -> PrereleaseTags -> SemVer -- | Create a SemVer with tags and metadata. semver'' :: Int -> Int -> Int -> PrereleaseTags -> BuildMetaData -> SemVer -- | 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 prerelease tags from a version range. rangePrereleaseTags :: SemVerRange -> PrereleaseTags -- | Get the range prerelease tags if they're all the same; otherwise -- Nothing. sharedTags :: SemVerRange -> Maybe PrereleaseTags -- | Satisfies any version. anyVersion :: SemVerRange -- | Render a semver as Text. renderSV :: SemVer -> Text -- | 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. matches :: SemVerRange -> SemVer -> Bool infixl 2 `matches` -- | 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 -> PrereleaseTags -> PrereleaseTags -> Bool -- | Gets the highest-matching semver in a range. bestMatch :: SemVerRange -> [SemVer] -> Either String SemVer -- | 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 -- | Parses the first argument as a range and the second argument as a -- semver, and returns whether they match. matchText :: Text -> Text -> Either Text Bool -- | Split a text on whitespace. Why isn't this in the stdlib. splitWS :: Text -> [Text]