File tree 1 file changed +11
-7
lines changed
cabal-install/Distribution/Solver/Modular 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -113,15 +113,19 @@ preferLatestOrdering (I v1 _) (I v2 _) = compare v1 v2
113
113
preferPackageStanzaPreferences :: (PN -> PackagePreferences ) -> Tree a -> Tree a
114
114
preferPackageStanzaPreferences pcs = trav go
115
115
where
116
- go (SChoiceF qsn@ (SN (PI (Q pp pn) _) s) gr _tr ts) | primaryPP pp =
117
- let PackagePreferences _ _ spref = pcs pn
118
- enableStanzaPref = s `elem` spref
119
- -- move True case first to try enabling the stanza
120
- ts' | enableStanzaPref = P. sortByKeys (flip compare ) ts
121
- | otherwise = ts
122
- in SChoiceF qsn gr (WeakOrTrivial True ) ts'
116
+ go (SChoiceF qsn@ (SN (PI (Q pp pn) _) s) gr _tr ts)
117
+ | primaryPP pp && enableStanzaPref pn s =
118
+ -- move True case first to try enabling the stanza
119
+ let ts' = P. sortByKeys (flip compare ) ts
120
+ -- defer the choice by setting it to weak
121
+ in SChoiceF qsn gr (WeakOrTrivial True ) ts'
123
122
go x = x
124
123
124
+ enableStanzaPref :: PN -> OptionalStanza -> Bool
125
+ enableStanzaPref pn s =
126
+ let PackagePreferences _ _ spref = pcs pn
127
+ in s `elem` spref
128
+
125
129
-- | Helper function that tries to enforce a single package constraint on a
126
130
-- given instance for a P-node. Translates the constraint into a
127
131
-- tree-transformer that either leaves the subtree untouched, or replaces it
You can’t perform that action at this time.
0 commit comments