Browse files

Merge.hs: cleanup: move optimizer code to separate helper

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information...
1 parent 2b5c12a commit de938f3908a3f15cd5887928d341294ebb212e94 @trofi trofi committed Dec 29, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 Merge.hs
View
7 Merge.hs
@@ -226,10 +226,13 @@ mergeGenericPackageDescription verbosity overlayPath cat pkgGenericDesc fetch =
-- flags that are failed to resolve
deadFlags = filter (\x -> all (x/=) $ map fst deps1) all_possible_flag_assignments
-- and finally prettify all deps:
+ optimize_fa_depends :: [([(Cabal.FlagName, Bool)], [Portage.Dependency])] -> [Portage.Dependency]
+ optimize_fa_depends deps = Portage.sortDeps . simplify $ map (\x -> (x,[])) $ map (first (filter (\x -> all (x/=) commonFlags))) deps
+
tdeps :: Merge.EDep
tdeps = (L.foldl' (\x y -> x `mappend` (snd y)) mempty deps1){
- Merge.dep = Portage.sortDeps . simplify $ map (\x -> (x,[])) $ map (first (filter (\x -> all (x/=) commonFlags))) $ map (second Merge.dep) deps1
- , Merge.rdep = Portage.sortDeps . simplify $ map (\x -> (x,[])) $ map (first (filter (\x -> all (x/=) commonFlags))) $ map (second Merge.rdep) deps1
+ Merge.dep = optimize_fa_depends $ map (second Merge.dep) deps1
+ , Merge.rdep = optimize_fa_depends $ map (second Merge.rdep) deps1
}
common :: [FlagDepH] -> FlagDepH

0 comments on commit de938f3

Please sign in to comment.