Data.Version
- Package
- purescript-versions
- Repository
- hdgarrood/purescript-versions
This module defines a Version
data type, for representing software
versions, according to the Semantic Versioning
specification. To summarize, a Version
consists of:
- a MAJOR, MINOR, and a PATCH component, all of which are nonnegative integers.
- optionally, a list of pre-release identifiers, consisting of ASCII letters, numbers, and hyphens, and which is separated from the three main components with a hyphen.
- optionally, build metadata, consisting of ASCII letters, numbers, and hyphens, and which is separated from the rest of the version with a plus symbol.
Note that, according to the semver spec, version precedence must ignore
any build metadata. Therefore, the Ord
instance ignores the build
metadata. In order to have the Eq
instance agree with the Ord
instance, the Eq
instance ignores build metadata too.
#version Source
version :: Int -> Int -> Int -> List Identifier -> List Identifier -> Version
Smart constructor for versions. Negative integer components will be replaced with zeroes.
#runVersion Source
runVersion :: forall r. (Int -> Int -> Int -> List Identifier -> List Identifier -> r) -> Version -> r
Unpack a version. Useful for pattern matching.
The reason we have this function instead of exporting the Version
constructor is that in this way we can guarantee that Version
values are
always valid.
#preRelease Source
preRelease :: Version -> List Identifier
#buildMetadata Source
buildMetadata :: Version -> List Identifier
#isPreRelease Source
isPreRelease :: Version -> Boolean
Tells you whether a version is a pre-release version; that is, if it has any pre-release identifiers.
#numeric Source
numeric :: Int -> Identifier
Construct a numeric identifier.
#showVersion Source
showVersion :: Version -> String