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=refs%2Fheads%2Fmaster;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