diff --git a/cabal-install-solver/src/Distribution/Solver/Modular.hs b/cabal-install-solver/src/Distribution/Solver/Modular.hs index 9e949358ae7..dd2e43f9b50 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular.hs @@ -122,7 +122,7 @@ solve' :: SolverConfig -> Set PN -> Progress SolverTrace String (Assignment, RevDepMap) solve' sc cinfo idx pkgConfigDB pprefs gcs pns = - toProgress $ retry (runSolver printFullLog sc) handleFailure + toProgress $ retry (runSolver printFullLog sc) createErrorMsg where runSolver :: Bool -> SolverConfig -> RetryLog SolverTrace SolverFailure (Assignment, RevDepMap) @@ -130,9 +130,9 @@ solve' sc cinfo idx pkgConfigDB pprefs gcs pns = displayLogMessages keepLog $ solve sc' cinfo idx pkgConfigDB pprefs gcs pns - handleFailure :: SolverFailure + createErrorMsg :: SolverFailure -> RetryLog SolverTrace String (Assignment, RevDepMap) - handleFailure failure@(ExhaustiveSearch cs _cm) = + createErrorMsg failure@(ExhaustiveSearch cs _cm) = if asBool $ minimizeConflictSet sc then continueWith (mkErrorMsg ("Found no solution after exhaustively searching the " ++ "dependency tree. Rerunning the dependency solver " @@ -153,7 +153,7 @@ solve' sc cinfo idx pkgConfigDB pprefs gcs pns = ++ finalErrorMsg sc failure else fromProgress $ Fail $ rerunSolverForErrorMsg cs ++ finalErrorMsg sc failure - handleFailure failure@BackjumpLimitReached = + createErrorMsg failure@BackjumpLimitReached = continueWith (mkErrorMsg ("Backjump limit reached. Rerunning dependency solver to generate " ++ "a final conflict set for the search tree containing the " diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Log.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Log.hs index ccb3448c741..d60f1b1204a 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/Log.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/Log.hs @@ -25,7 +25,7 @@ displayLogMessages :: Bool -> RetryLog SolverTrace SolverFailure a displayLogMessages keepLog lg = fromProgress $ if keepLog - then groupMessages progress + then summarizeMessages progress else foldProgress (const id) Fail Done progress where progress = toProgress lg diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Message.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Message.hs index 620ac09d008..c800254fa3e 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/Message.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/Message.hs @@ -3,7 +3,7 @@ module Distribution.Solver.Modular.Message ( Message(..), SolverTrace(..), - groupMessages, + summarizeMessages, ) where import qualified Data.List as L @@ -78,7 +78,7 @@ displayMessage :: Log -> String displayMessage (PackageGoal qpn gr) = "next goal: " ++ showQPN qpn ++ showGR gr displayMessage (RejectF qfn b c fr) = "rejecting: " ++ showQFNBool qfn b ++ showFR c fr displayMessage (RejectS qsn b c fr) = "rejecting: " ++ showQSNBool qsn b ++ showFR c fr -displayMessage (Skipping' cs) = showConflicts cs +displayMessage (Skipping' cs) = "skipping: " ++ showConflicts cs displayMessage (TryingF qfn b) = "trying: " ++ showQFNBool qfn b displayMessage (TryingP qpn i mgr) = "trying: " ++ showQPNPOpt qpn i ++ maybe "" showGR mgr displayMessage (TryingS qsn b) = "trying: " ++ showQSNBool qsn b @@ -123,8 +123,8 @@ displayMessage (RejectMany qpn is c fr) = "rejecting: " ++ L.intercalate ", " (m -- The log contains level numbers, which are useful for any trace that involves -- backtracking, because only the level numbers will allow to keep track of -- backjumps. -groupMessages :: Progress Message a b -> Progress SolverTrace a b -groupMessages = go 0 +summarizeMessages :: Progress Message a b -> Progress SolverTrace a b +summarizeMessages = go 0 where -- 'go' increments the level for a recursive call when it encounters -- 'TryP', 'TryF', or 'TryS' and decrements the level when it encounters 'Leave'.