Skip to content

Commit

Permalink
An attempt at being lazier for allGetPackages
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-m committed Jul 31, 2010
1 parent 9330419 commit 6634bf4
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions Main.hs
Expand Up @@ -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)
Expand Down Expand Up @@ -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

-- -----------------------------------------------------------------------------
Expand Down

0 comments on commit 6634bf4

Please sign in to comment.