[Haskell-cafe] RE: [Haskell] Re: Trying to install binary-0.4

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Tue Oct 16 18:55:11 EDT 2007


On Tue, 2007-10-16 at 14:01 +0100, Bayley, Alistair wrote:
> > From: Simon Marlow [mailto:simonmarhaskell at gmail.com] 
> > 
> > The lexicographical ordering would make 10.0 > 9.3.  In 
> > general, A.B > C.D 
> > iff A > C or A == C && B > D.  When we say the "latest" 
> > version we mean 
> > "greatest", implying that version numbers increase with time. 
> >  Does that help?
> 
> 
> Sort of. It's what I'd expect from a sensible version comparison. It's
> just not something I'd ever choose to call lexicographic ordering. IMO,
> lexicographgic ordering is a basic string comparision so e.g.
> 
> max "10.0" "9.3" = "9.3"
> 
> I'd call what you're doing numeric ordering. Does it have a better name,
> like version-number-ordering, or section-number-ordering (e.g. Section
> 3.2.5, Section 3.2.6)?

It's lexicographic ordering on the list of numbers, not on the string
representation. 

ie it's

[10, 0] > [9, 3]

not 

"10.0" > "9.3"


Internally we represent version numbers as lists of integers and use the
default Ord instance.

Duncan


More information about the Haskell-Cafe mailing list