Cabal: Conditional code and dependencies

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Thu Jul 21 06:59:41 EDT 2005


"Simon Marlow" <simonmar at microsoft.com> writes:

> > #if __PACKAGE_foo__ >= 110 -- Is package foo-1.1 or later available?
> 
> Absolutely - this thought also crossed my mind recently.  We should
> agree on a convention.  __PACKAGE_<name>__  seems reasonable, but what
> about the version number?  We could adopt the same policy as
> __GLASGOW_HASKELL__, namely major*100+minor, and discard any futher
> dimensions in the version number (e.g. 1.1.1 and 1.1.2 both get
> __PACKAGE_foo__==101).  This perhaps isn't as intuitive as it could be:
> people tend to write 110 when they want 101.  So is there an
> alternate/better scheme?

Intuitively, I think many people use this formula:

    read . take 3 . filter isDigit . (++"000")

So version numbers would translate roughly like:

	1	100
	1.0	100
	1.1	110
	1.1.1	111
	1.1.2	112
	1.12	112
	1.12.1	112

Although this is ambiguous, my feeling is that in projects using
major.minor.smaller, the minor number tends not to rise above 9,
and conversely, if a project's minor number rises above 9, it tends
only to use two levels of numbering not three.

Regards,
    Malcolm


More information about the Libraries mailing list