
Proposal: that values of the type Data.Version.Version should compare
equal, by ignoring trailing zeros.
Thus 1.2.0 == 1.2, rather than 1.2.0 > 1.2
Regards,
Malcolm
----
New patches:
[In Data.Version, make equality comparisons independent of trailing zeros.
Malcolm.Wallace@cs.york.ac.uk**20071025161240] {
hunk ./Data/Version.hs 122
- v1 == v2 = versionBranch v1 == versionBranch v2
+ v1 == v2 = branchEq (versionBranch v1) (versionBranch v2)
hunk ./Data/Version.hs 125
+ where
+ branchEq :: [Int] -> [Int] -> Bool
+ branchEq [] [] = True
+ branchEq vs [] = all (==0) vs
+ branchEq [] vs = all (==0) vs
+ branchEq (v:vs) (w:ws) = v==w && branchEq vs ws
hunk ./Data/Version.hs 133
- v1 `compare` v2 = versionBranch v1 `compare` versionBranch v2
-
+ v1 `compare` v2 = versionBranch v1 `cmpBranch` versionBranch v2
+ where
+ cmpBranch [] [] = EQ
+ cmpBranch vs [] | all (==0) vs = EQ
+ | otherwise = GT
+ cmpBranch [] vs | all (==0) vs = EQ
+ | otherwise = LT
+ cmpBranch (v:vs) (w:ws) | v==w = cmpBranch vs ws
+ | otherwise = compare v w
+
}
Context:
[Fix doc building with Haddock 0.9
Simon Marlow