Fix finding consistent component solution for targets

Union does the wrong thing, I wanted an intersection here.
This commit is contained in:
Daniel Gröber 2015-04-12 02:40:39 +02:00
parent 39a8ded102
commit 2bf4c80580
1 changed files with 6 additions and 1 deletions

View File

@ -174,7 +174,7 @@ targetGhcOptions crdl sefnmn = do
mcs <- cached cradleRootDir resolvedComponentsCache comps
let mdlcs = moduleComponents mcs `zipMap` Set.toList sefnmn
candidates = Set.unions $ map snd mdlcs
candidates = findCandidates $ map snd mdlcs
let noCandidates = Set.null candidates
noModuleHasAnyAssignment = all (Set.null . snd) mdlcs
@ -249,6 +249,11 @@ moduleComponents m efnmn =
foldr' b as f = Map.foldr f b as
findCandidates :: [Set ChComponentName] -> Set ChComponentName
findCandidates [] = Set.empty
findCandidates scns = foldl1 Set.intersection scns
pickComponent :: Set ChComponentName -> ChComponentName
pickComponent scn = Set.findMin scn