PROPOSAL: Extended syntax for package version range specifications

Thomas Schilling nominolo at googlemail.com
Mon Jan 21 17:26:43 EST 2008


In order to make it easy for package package authors to describe correct
and robust dependencies we (Duncan Coutts and I) propose the following
syntactical extension to version range specifications in package files.

(1) Wildcards

  ~ 1.2.*  ~~>  >= 1.2 && < 1.3

in general

  ~ x.y.*   ~~>   >= x.y && < x.(y+1)

The "~" operator should be read as "in the range of".  Another option
would have been "-", but this is used to specify exact versions in other
parts of the Cabal infrastructure , e.g., "cabal install xmonad-0.5".

This is the most common specification of package dependencies.  The
assumption is that changes in the last version number indicate only
backwards compatible changes, as is suggested in the new package
versioning policy [1].  The use of "*" matches the common usage as a
wildcard character.

 (2) Upward Ranges

 ~ 1.2.1+  ~~>  >= 1.2.1 && < 1.3

in general

 ~ x.y.z+  ~~>  >= x.y.z && < x.(y+1)

The idea here is that sometimes packages need a certain patch level or,
as in Cabal's case, a stable release and possible further bugfixes.  In
those cases the wildcard notation is too liberal, however the explicit
range description would be too noisy (and possibly error prone).  (Also,
using "+" instead of "*" serves as better visual distinction.)

We believe, that these kinds of ranges will become very common, thus
justifying a syntactic extension.  It also encourages specifying correct
dependency descriptions, thus could increase the quality of packages on
Hackage overall.

It could be argued that 1.2.3+ could be misunderstood as > 1.2.3.
However, if package authors start to adopt the new package versioning
policy, this would actually Do The Right Thing (tm).


/ Thomas (& Duncan)

[1] .. http://haskell.org/haskellwiki/Package_versioning_policy
   



More information about the cabal-devel mailing list