| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Ecluse.Core.Version
Description
Version identity and ecosystem ordering.
Wire text remains verbatim. Advisory identity uses renderVersionKey.
Opaque keys carry parsed versions under bounded ecosystem grammars.
Synopsis
- data Version
- versionKey :: Version -> Maybe VersionKey
- versionKeyIn :: Ecosystem -> Version -> Maybe VersionKey
- mkVersion :: Ecosystem -> Text -> Version
- renderVersion :: Version -> Text
- releaseIdentity :: Version -> Text
- compareVersions :: Version -> Version -> Maybe Ordering
- data VersionKey
- parseVersionKey :: Ecosystem -> Text -> Either VersionError VersionKey
- parseAdvisoryVersionKey :: Ecosystem -> Text -> Either VersionError VersionKey
- renderVersionKey :: VersionKey -> Text
- newtype VersionError = VersionError {}
- isStable :: VersionKey -> Bool
- canonicalPep440 :: Text -> Maybe Version
- selectLatest :: Maybe Version -> [Version] -> Maybe Version
Versions
The raw text as published, plus its ordering key when it parses. No Ord: compare with compareVersions.
versionKey :: Version -> Maybe VersionKey Source #
The canonical ordering key, or Nothing when the text did not parse for its ecosystem, so ordering rules abstain.
versionKeyIn :: Ecosystem -> Version -> Maybe VersionKey Source #
The key mkVersion builds under an ecosystem's grammar, reusing the carried key when it is that ecosystem's and parsing otherwise.
mkVersion :: Ecosystem -> Text -> Version Source #
Build a Version with its evaluated key. An unparseable version stays, keyless, so a parser gap drops nothing.
renderVersion :: Version -> Text Source #
Render a version in wire form: the raw text, verbatim as published.
releaseIdentity :: Version -> Text Source #
The spelling a registry treats as one release. Cargo ignores build metadata, and other ecosystems keep the raw text.
compareVersions :: Version -> Version -> Maybe Ordering Source #
Compare by canonical keys. Nothing when either version has no key, so an ordering rule abstains.
Canonical ordering keys
data VersionKey Source #
The canonical, comparable form of a version. It is opaque and built only by parsing, so no comparator sees non-canonical input.
Instances
| Show VersionKey Source # | |
Defined in Ecluse.Core.Version Methods showsPrec :: Int -> VersionKey -> ShowS # show :: VersionKey -> String # showList :: [VersionKey] -> ShowS # | |
| Eq VersionKey Source # | |
Defined in Ecluse.Core.Version | |
| Ord VersionKey Source # | |
Defined in Ecluse.Core.Version Methods compare :: VersionKey -> VersionKey -> Ordering # (<) :: VersionKey -> VersionKey -> Bool # (<=) :: VersionKey -> VersionKey -> Bool # (>) :: VersionKey -> VersionKey -> Bool # (>=) :: VersionKey -> VersionKey -> Bool # max :: VersionKey -> VersionKey -> VersionKey # min :: VersionKey -> VersionKey -> VersionKey # | |
parseVersionKey :: Ecosystem -> Text -> Either VersionError VersionKey Source #
Parse version text under its ecosystem's grammar. The key's Ord is meaningful only within one ecosystem.
parseAdvisoryVersionKey :: Ecosystem -> Text -> Either VersionError VersionKey Source #
Parse an advisory spelling, accepting one npm v prefix within the raw length bound.
renderVersionKey :: VersionKey -> Text Source #
Render canonical advisory identity, retaining semver build metadata.
newtype VersionError Source #
Why a version string failed to parse.
Constructors
| VersionError | |
Fields | |
Instances
| Show VersionError Source # | |
Defined in Ecluse.Core.Version Methods showsPrec :: Int -> VersionError -> ShowS # show :: VersionError -> String # showList :: [VersionError] -> ShowS # | |
| Eq VersionError Source # | |
Defined in Ecluse.Core.Version | |
isStable :: VersionKey -> Bool Source #
Whether a version is a final release under its ecosystem's grammar.
Canonical PEP 440 spelling
canonicalPep440 :: Text -> Maybe Version Source #
Build the canonical PEP 440 spelling used to merge equivalent PyPI releases.