SemanticVersionRange

A module for working with ranges of semantic versions, like 1.0.0 <= v < 2.0.0.

type SemanticVersionRange

A range of SemanticVersion values between a lower value (inclusive) and an upper value (exclusive).

example : SemanticVersionRange

An example range. More specifically, the range 1.0.0 <= v < 2.0.0.

Construction

of :
SemanticVersion
-> SemanticVersion
-> Maybe SemanticVersionRange

Construct a SemanticVersionRange between the two provided SemanticVersions. This function will return Nothing if the first value is less than or equal to the second.

fromExact : SemanticVersion -> SemanticVersionRange

Construct a SemanticVersionRange where the provided SemanticVersion is the only contained value.

Using the function with the version 1.5.0 will return the range 1.5.0 <= v < 1.5.1.

compatibleWith : SemanticVersion -> SemanticVersionRange

Construct a SemanticVersionRange that is compatible with the provided SemanticVersion, and other semantically compatible versions.

Using this function with the version 1.2.3 will return the range 1.2.0 <= v < 2.0.0.

fromString : String -> Maybe SemanticVersionRange

Convert a String formatted like 1.0.0 <= v < 2.0.0 to a SemanticVerisonRange.

jsonDecoder : Decoder SemanticVersionRange

JSON Decoder for a SemanticVersionRange.

Query

lowerBound : SemanticVersionRange -> SemanticVersion

Returns the lowest SemanticVersion of a SemanticVersionRange.

upperBound : SemanticVersionRange -> SemanticVersion

Returns the lowest SemanticVersion which is higher than all other versions of the SemanticVersionRange.

intersect :
SemanticVersionRange
-> SemanticVersionRange
-> Maybe SemanticVersionRange

Construct a SemanticVersionRange that forms the intersection of the two provided values.

Conversion

toString : SemanticVersionRange -> String

Create a String representation of a SemanticVersionRange.

toJson : SemanticVersionRange -> Value

Encode a SemanticVersionRange as JSON.