From: PHO Date: Fri, 2 Oct 2009 03:42:50 +0000 (+0900) Subject: code cleanup X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=a63e1d1d81ee1c2813d798a7e95aa4727bc27653;p=pkg-find-outdated-cabal.git code cleanup --- diff --git a/Main.hs b/Main.hs index 13bc948..c7d4980 100644 --- a/Main.hs +++ b/Main.hs @@ -58,7 +58,7 @@ scanPkgs runQuery = mapM_ scanPkg 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") @@ -69,11 +69,10 @@ scanPkgs runQuery = mapM_ scanPkg 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