Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d1d76cf

Browse files
committedJun 3, 2025·
Modular-solver: Simplify
Extensive effort was put in to simplify the solver. In the end only a pretty minor simplification was possible.
1 parent 08c2a5d commit d1d76cf

File tree

1 file changed

+6
-6
lines changed
  • cabal-install-solver/src/Distribution/Solver

1 file changed

+6
-6
lines changed
 

‎cabal-install-solver/src/Distribution/Solver/Modular.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ tryToMinimizeConflictSet :: forall a . (SolverConfig -> RetryLog SummarizedMessa
245245
-> ConflictMap
246246
-> RetryLog SummarizedMessage SolverFailure a
247247
tryToMinimizeConflictSet runSolver sc cs cm =
248-
foldl (\r v -> retryMap mkErrorMsg $ retryNoSolution (retryMap renderSummarizedMessage r) $ tryToRemoveOneVar v)
248+
foldl (\r v -> retryNoSolution r $ tryToRemoveOneVar v)
249249
(fromProgress $ Fail $ ExhaustiveSearch cs cm)
250250
(CS.toList cs)
251251
where
@@ -269,14 +269,14 @@ tryToMinimizeConflictSet runSolver sc cs cm =
269269
tryToRemoveOneVar :: Var QPN
270270
-> ConflictSet
271271
-> ConflictMap
272-
-> RetryLog String SolverFailure a
272+
-> RetryLog SummarizedMessage SolverFailure a
273273
tryToRemoveOneVar v smallestKnownCS smallestKnownCM
274274
-- Check whether v is still present, because it may have already been
275275
-- removed in a previous solver rerun.
276276
| not (v `CS.member` smallestKnownCS) =
277277
fromProgress $ Fail $ ExhaustiveSearch smallestKnownCS smallestKnownCM
278278
| otherwise =
279-
continueWith ("Trying to remove variable " ++ varStr ++ " from the "
279+
retryMap mkErrorMsg $ continueWith ("Trying to remove variable " ++ varStr ++ " from the "
280280
++ "conflict set.") $
281281
retry (retryMap renderSummarizedMessage $ runSolver sc') $ \case
282282
err@(ExhaustiveSearch cs' _)
@@ -310,9 +310,9 @@ tryToMinimizeConflictSet runSolver sc cs cm =
310310

311311
-- Like 'retry', except that it only applies the input function when the
312312
-- backjump limit has not been reached.
313-
retryNoSolution :: RetryLog step SolverFailure done
314-
-> (ConflictSet -> ConflictMap -> RetryLog step SolverFailure done)
315-
-> RetryLog step SolverFailure done
313+
retryNoSolution :: RetryLog SummarizedMessage SolverFailure done
314+
-> (ConflictSet -> ConflictMap -> RetryLog SummarizedMessage SolverFailure done)
315+
-> RetryLog SummarizedMessage SolverFailure done
316316
retryNoSolution lg f = retry lg $ \case
317317
ExhaustiveSearch cs' cm' -> f cs' cm'
318318
BackjumpLimitReached -> fromProgress (Fail BackjumpLimitReached)

0 commit comments

Comments
 (0)
Please sign in to comment.