The Haskell CabalSource codeContentsIndex
Distribution.Version
Portability GHC
Stability alpha
Maintainer Isaac Jones <ijones@syntaxpolice.org>
Contents
The Version type
Package versions
Version ranges
Description
Explanation: Represents and parses versions like Nov-2003, 1.2-4, etc.
Synopsis
data Version = Version {
versionBranch :: [Int]
versionTags :: [String]
}
showVersion :: Version -> String
parseVersion :: ReadP r Version
data VersionRange
= AnyVersion
| ThisVersion Version
| LaterVersion Version
| EarlierVersion Version
| UnionVersionRanges VersionRange VersionRange
| IntersectVersionRanges VersionRange VersionRange
orLaterVersion :: Version -> VersionRange
orEarlierVersion :: Version -> VersionRange
betweenVersionsInclusive :: Version -> Version -> VersionRange
withinRange :: Version -> VersionRange -> Bool
showVersionRange :: VersionRange -> String
parseVersionRange :: ReadP r VersionRange
The Version type
data Version

A Version represents the version of a software entity.

An instance Eq is provided, which implements exact equality modulo reordering of the tags in the versionTags field.

The interpretation of ordering is dependent on the entity being versioned, and perhaps the application. For example, simple branch ordering is probably sufficient for many uses (see the versionBranch field), but some versioning schemes may include pre-releases which have tags pre1, pre2, and so on, and these would need to be taken into account when determining ordering. In some cases, date ordering may be more appropriate, so the application would have to look for date tags in the versionTags field and compare those.

Similarly, concrete representations of versions may differ, so we leave parsing and printing up to the application.

Constructors
Version
versionBranch :: [Int]

The numeric branch for this version. This reflects the fact that most software versions are tree-structured; there is a main trunk which is tagged with versions at various points (1,2,3...), and the first branch off the trunk after version 3 is 3.1, the second branch off the trunk after version 3 is 3.2, and so on. The tree can be branched arbitrarily, just by adding more digits.

We represent the branch as a list of Int, so version 3.2.1 becomes [3,2,1]. Lexicographic ordering (i.e. the default instance of Ord for [Int]) gives the natural ordering of branches.

versionTags :: [String]A version can be tagged with an arbitrary list of strings. The interpretation of the list of tags is entirely dependent on the entity that this version applies to.
Instances
Eq Version
Read Version
Show Version
Package versions
showVersion :: Version -> String
parseVersion :: ReadP r Version
Parse any kind of version
Version ranges
data VersionRange
Constructors
AnyVersion
ThisVersion Version
LaterVersion Version
EarlierVersion Version
UnionVersionRanges VersionRange VersionRange
IntersectVersionRanges VersionRange VersionRange
Instances
Show VersionRange
Read VersionRange
Eq VersionRange
orLaterVersion :: Version -> VersionRange
orEarlierVersion :: Version -> VersionRange
betweenVersionsInclusive :: Version -> Version -> VersionRange
withinRange :: Version -> VersionRange -> Bool
Does this version fall within the given range?
showVersionRange :: VersionRange -> String
parseVersionRange :: ReadP r VersionRange
Produced by Haddock version 0.6