preferred-versions and hackage index

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu Oct 9 16:28:31 EDT 2008


Hi Ross,

As part of the plan for keeping most of hackage working with ghc-6.10
I've implemented a feature in cabal-install to allow soft version
constraints. This is a general feature I've wanted for some time but it
also helps with the base 3 / 4 issue.

The basic idea is that globally we make a suggestion to users about
which is the version of a package they should be using. This should make
it easier to release experimental versions of packages on hackage
because we may still be able to point users to the recommended one
rather than the default suggestion that higher number is always better.

These preferences are expressed in constraint syntax, eg:

base < 4
QuickCheck < 2
parsec < 3
HaXml == 1.13.*

Eventually we would want to uses these to make the unversioned package
web pages point to the recommended rather than latest version.

What I've done so far however is to make cabal-install take these
preferences into account. They're only soft preferences that are used to
decide when there are free choices. So packages can of course still
depend on parsec >= 3 or whatever.

This preference mechanism is partly to make up for the fact that people
specify too lax version ranges in their package .cabal files. The longer
term plan should be to get packages to opt-in to the versioning policy
and then to have cabal suggest that dependencies on such packages use
closed version ranges, targeting major api versions.

What needs to happen next is that these preferences be included into the
hackage index that cabal-install and other clients download. This should
be completely backwards compatible. The format allows for adding other
files with different extensions and older clients will just ignore them.

So if you don't mind what I'll do is to add a "preferred-versions" text
file into the archive and adjust the script that generates the
00-index.tar.gz file to pick up that text file too.

Duncan



More information about the cabal-devel mailing list