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

ModuleCabal-syntax-3.12.1.0Haskell2010

Distribution.Types.VersionRange.Internal

The only purpose of this module is to prevent the export of VersionRange constructors from Distribution.Types.VersionRange. To avoid creating orphan instances, a lot of related code had to be moved here too.

  • 2 types
  • 20 values
datadata VersionRange
#
Instances13Eq, Data, Ord, Read, Show, Generic, …

The version range -any. That is, a version range containing all versions.

withinRange v anyVersion = True

The empty version range -none, that is a version range containing no versions.

This can be constructed using any unsatisfiable version range expression, for example < 0.

withinRange v noVersion = False

The version range == v.*.

For example, for version 1.2, the version range == 1.2.* is the same as >= 1.2 && < 1.3.

withinRange v' (withinVersion v) = v' >= v && v' < upper v
  where
    upper (Version lower t) = Version (init lower ++ [last lower + 1]) t

The version range ^>= v.

For example, for version 1.2.3.4, the version range ^>= 1.2.3.4 is the same as >= 1.2.3.4 && < 1.3.

Note that ^>= 1 is equivalent to >= 1 && < 1.1.

datadata VersionRangeF a
#

F-Algebra of VersionRange. See cataVersionRange.

Constructors

Instances9Functor, Foldable, Traversable, Eq, Data, Read, …

Compute next greater major version to be used as upper bound.

Example: 0.4.1 produces the version 0.5 which then can be used to construct a range >= 0.4.1 && < 0.5

Increment the last version number.

Example: For 1.2 this returns 1.3 so that it can be used as upper bound when resolving == 1.2.*. For 0.4.1 it returns 0.4.2.