name = extractPkgName distname
ver = extractPkgVersion distname
pkgId = PackageIdentifier name ver
- query = Id (sameName pkgId) :& Id (newerVers pkgId)
+ query = Id ((`isNewerThan` pkgId) . package)
in
case runQuery query of
[] -> putStrLn (distname ++ ": is the LATEST")
putStrLn (distname ++ ": has a newer version " ++ showVersion lVer)
_ -> return ()
- sameName :: PackageIdentifier -> PackageIdentifier -> Bool
- sameName a b = pkgName a == pkgName b
-
- newerVers :: PackageIdentifier -> PackageIdentifier -> Bool
- newerVers a b = pkgVersion a < pkgVersion b
+ isNewerThan :: PackageIdentifier -> PackageIdentifier -> Bool
+ isNewerThan a b
+ = pkgName a == pkgName b &&
+ pkgVersion a > pkgVersion b
cmpVers :: PackageDescription -> PackageDescription -> Ordering
cmpVers a b = (pkgVersion . package) a `compare` (pkgVersion . package) b