HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulesemver-0.4.0.1Haskell2010

Data.SemVer

An implementation of the Semantic Versioning specification located at http://semver.org.

A canonical Version type and functions representing behaviour as outlined in the specification are defined alongside additional lenses, traversals, common manipulations, and serialisation primitives.

  • 2 types
  • 23 values
  • Packagesemver-0.4.0.1
  • Exports25
  • LanguageHaskell2010
  • LicenceMPL-2.0
  • SourceSemVer.hs

Version

1 declaration
datadata Version
#

An opaque type representing a successfully decoded or constructed semantic version. See the related functions and lenses for modification and update.

  • The Eq instance represents exhaustive equality with all components considered.

  • The Ord instance implements the precedence rules from the semantic version specification with metadata being ignored.

Instances5Eq, Ord, Show, NFData, Hashable
  • Eq VersionDefined in semver-0.4.0.1 · Data.SemVer.Internal
  • Ord VersionDefined in semver-0.4.0.1 · Data.SemVer.Internal
  • Show VersionDefined in semver-0.4.0.1 · Data.SemVer.Internal
  • NFData VersionDefined in semver-0.4.0.1 · Data.SemVer.Internal
  • Hashable VersionDefined in semver-0.4.0.1 · Data.SemVer.Internal

Constructors

valueversion
  1. :: Int

    Major version component.

  2. -> Int

    Minor version component.

  3. -> Int

    Patch version component.

  4. -> [Identifier]

    Release identifiers.

  5. -> [Identifier]

    Metadata identifiers.

  6. -> Version
#

Smart constructor fully specifying all available version components.

valueinitial :: Version
#

A default Version which can be used to signify initial development.

Note: Equivalent to 0.0.0

Lenses

Incrementing

The following increment functions are used to ensure that the related version components are reset according to the specification.

See the individual function documentation for specifics regarding each version component.

Increment the major component of a Version by 1, resetting the minor and patch components.

  • Major version X (X.y.z | X > 0) MUST be incremented if any backwards incompatible changes are introduced to the public API.

  • It MAY include minor and patch level changes.

  • Patch and minor version MUST be reset to 0 when major version is incremented.

Increment the minor component of a Version by 1, resetting the patch component.

  • Minor version Y (x.Y.z | x > 0) MUST be incremented if new, backwards compatible functionality is introduced to the public API.

  • It MUST be incremented if any public API functionality is marked as deprecated.

  • It MAY be incremented if substantial new functionality or improvements are introduced within the private code.

  • It MAY include patch level changes.

  • Patch version MUST be reset to 0 when minor version is incremented.

Increment the patch component of a Version by 1.

  • Patch version Z (x.y.Z | x > 0) MUST be incremented if only backwards compatible bug fixes are introduced.

  • A bug fix is defined as an internal change that fixes incorrect behavior.

Predicates

valueisDevelopment :: Version -> Bool
#

Check if the Version is considered unstable.

  • Major version zero (0.y.z) is for initial development.

  • Anything may change at any time.

  • The public API should not be considered stable.

valueisPublic :: Version -> Bool
#

Check if the Version is considered stable.

Version 1.0.0 defines the public API. The way in which the version number is incremented after this release is dependent on this public API and how it changes.

Encoding

valuetoString :: Version -> String
#

Convert a Version to it's readable String representation.

Note: This is optimised for cases where you require String output, and as such is faster than the semantically equivalent unpack . toLazyText.

Decoding

Identifiers

1 declaration
datadata Identifier
#

A type representing an individual identifier from the release or metadata components of a Version.

  • The Ord instance implements precedence according to the semantic version specification, with numeric identifiers being of lower precedence than textual identifiers, otherwise lexicographic ordering is used.

The functions numeric and textual can be used to construct an Identifier.

Instances5Eq, Ord, Show, NFData, Hashable

Constructors

Prisms