Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal On branch : master
http://hackage.haskell.org/trac/ghc/changeset/5fbb362ee4e897850626b9b856d16ca5adbecf8e >--------------------------------------------------------------- commit 5fbb362ee4e897850626b9b856d16ca5adbecf8e Author: bjorn <[email protected]> Date: Thu Oct 4 16:25:38 2007 +0000 Refactor flattenDepList. >--------------------------------------------------------------- .../src/Network/Hackage/CabalInstall/Dependency.hs | 21 +++++-------------- 1 files changed, 6 insertions(+), 15 deletions(-) diff --git a/cabal-install/src/Network/Hackage/CabalInstall/Dependency.hs b/cabal-install/src/Network/Hackage/CabalInstall/Dependency.hs index 298ba8f..5b18d3b 100644 --- a/cabal-install/src/Network/Hackage/CabalInstall/Dependency.hs +++ b/cabal-install/src/Network/Hackage/CabalInstall/Dependency.hs @@ -47,21 +47,12 @@ import Text.Printf (printf) flattenDepList :: [PackageIdentifier] -- ^List of installed packages. -> [ResolvedPackage] -- ^List of resolved packages. -> [ResolvedPackage] -flattenDepList ps deps - = nub $ worker deps - where isBeingInstalled dep - = not . null $ flip mapMaybe deps $ \rpkg -> do (pkg,_,_) <- resolvedData rpkg - guard (fulfillDependency dep pkg) - worker [] = [] - worker (pkgInfo:xs) - = case getLatestPkg ps (fulfilling pkgInfo) of - Just _pkg -> worker xs - Nothing - -> case resolvedData pkgInfo of - Just (_pkg,_location,subDeps) - -> worker (filter (not.isBeingInstalled.fulfilling) subDeps) ++ pkgInfo:worker xs - Nothing - -> pkgInfo:worker xs +flattenDepList ps + = nub . filter (not . isInstalled ps . fulfilling) . concatMap flatten + where flatten pkgInfo = subs ++ [pkgInfo] + where subs = case resolvedData pkgInfo of + Just (_,_,subDeps) -> concatMap flatten subDeps + Nothing -> [] -- |Flattens a dependency list while only keeping the dependencies of the packages. -- This is used for installing all the dependencies of a package but not the package itself. _______________________________________________ Cvs-libraries mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-libraries
