RFC: Extended version-range descriptions for Cabal
Thomas Schilling
nominolo at googlemail.com
Mon Sep 24 15:53:16 EDT 2007
Hi librarians,
I'd like to propose a an extension to Cabal's dependency description
syntax. Cabal currently supports version range descriptions using the
unary operators >, >=, <, <=, ==, and binary operators && and ||. This
can lead to rather awkward descriptions of common version ranges, for
example,
base >= 1 && < 2
and could lead to subtle errors like
base > 1 && < 2
or
base >= 1 && <= 2
I therefore propose two extensions. Both are just syntactic sugar.
(1) Wildcards:
1.* ~~> >= 1 && < 2
in general
m.n.o.* ~~> >= m.n.o && < m.n.(o+1)
Note, that the translation is not ">= 1.0 && < 2", because that would
exclude version "1", as [1] < [1,0] == True.
(2) Ranges:
1 - 2.1 ~~> >= 1 && <= 2.1
in general
m - n ~~> >= m && <= n
If the upper limit is supposed to be exclusive, this can be combined
with (1):
1 - 2.0.* ~~> >= 1 && < 2.1
A possible alternatve syntax (subsuming both (1) and (2)) could be:
[1, 2.1] ~~> >= 1 && <= 2.1
[1, 2.1) ~~> >= 1 && < 2.1
Although this syntax is closer to mathematical notation, I prefer the
former for it is more explicit and more similar to common conventions
used in other languages/package systems (an less scary scary to
non-math-aficiados).
I'd like include this into Cabal-1.2 which is scheduled with the next
ghc release, so it can fearlessly be used when getting packages ready
for GC 6.8.1.
Please comment/vote.
Thanks,
/ Thomas
More information about the cabal-devel
mailing list