version tags

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Thu May 8 19:07:42 EDT 2008


On Thu, 2008-05-08 at 15:39 -0700, Isaac Potoczny-Jones wrote:
> Duncan Coutts wrote:
> (snip)
> > Does this seem like a good idea? What is/was the rationale for tags in
> > the first place?
> 
> Yes, if I recall, Tags were not originally supposed to affect the 
> ordering of versions,

And actually they don't affect the ordering but they do affect equality.
Yes it's inconsistent.

If we look in the base library in Data.Version we find:

instance Eq Version where
  v1 == v2  =  versionBranch v1 == versionBranch v2 
                && sort (versionTags v1) == sort (versionTags v2)
                -- tags may be in any order

instance Ord Version where
  v1 `compare` v2 = versionBranch v1 `compare` versionBranch v2

This is clearly wrong. We would expect that:
     a == b
<=>  compare a b == EQ
but that does not hold here.

> but meant only for human consumption.  Whether 
> changing that now is a good idea or not, it's hard to say.  How many 
> packages in Hackage have any tags, for instance?

One. It was uploaded the other day which is why I just noticed that it's
a problem.

Duncan



More information about the cabal-devel mailing list