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

View File

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