Permalink
Browse files

An attempt at being lazier for allGetPackages

  • Loading branch information...
1 parent 9330419 commit 6634bf4fbee3a9742f535d4fbeb789e2a4d2c079 @ivan-m ivan-m committed Jul 31, 2010
Showing with 4 additions and 6 deletions.
  1. +4 −6 Main.hs
View
10 Main.hs
@@ -13,9 +13,10 @@ module Main where
import Distribution.Gentoo.GHC
import Distribution.Gentoo.Packages
import Distribution.Gentoo.PkgManager
+import Distribution.Gentoo.Util
import Data.Either(partitionEithers)
-import Data.List(foldl1')
+import Data.List(foldl1', nub)
import Data.Version(showVersion)
import qualified Data.Set as Set
import Data.Set(Set)
@@ -80,12 +81,9 @@ getPackages GhcUpgrade = oldGhcPkgs
getPackages DepCheck = brokenPkgs
getPackages AllInstalled = allInstalledPackages
-getPackages' :: BuildTarget -> IO (Set Package)
-getPackages' = liftM Set.fromList . getPackages
-
allGetPackages :: Set BuildTarget -> IO [Package]
-allGetPackages = liftM (Set.toList . Set.unions)
- . mapM getPackages'
+allGetPackages = liftM nub
+ . concatMapM getPackages
. Set.toList
-- -----------------------------------------------------------------------------

0 comments on commit 6634bf4

Please sign in to comment.