PubGrub.Version

Versions following the semantic versioning scheme of Major.Minor.Patch. This module provides functions to create and compare versions.

type Version

Type for semantic versions.

Displayable String representation of versions, for debug purposes.

toTuple : Version -> ( Int, Int, Int )

Retrieve a version as a tuple.

Predefined versions

Version 0.0.0

Version 1.0.0

Version 2.0.0

Version 3.0.0

Create a new version

new :
{ major : Int
, minor : Int
, patch : Int
}

Create a version with the given major, minor, and patch values v = major.minor.patch. Negative values are set to 0.

new_ : Int -> Int -> Int -> Version

Alternative constructor.

new_ mj mn p == new { major = mj, minor = mn, patch = p }
fromTuple : ( Int, Int, Int ) -> Version

Alternative constructor from a tuple.

fromTuple ( mj, mn, p ) == new_ mj mn p

Bump versions

Bump patch number of a version.

bumpPatch (new_ 1 0 3) == new_ 1 0 4

Bump minor number of a version.

bumpMinor (new_ 1 0 3) == new_ 1 1 0

Bump major number of a version.

bumpMajor (new_ 1 0 3) == new_ 2 0 0

Compare versions

Return the highest of two versions.

Return the lowest of two versions.

Check if a version is strictly higher than another version.

Check if a version is strictly lower than another version.