Skip to content
Snippets Groups Projects
Commit 8421806d authored by kristenk's avatar kristenk
Browse files

Replace a call to 'foldProgress'.

parent beb51061
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,6 @@ import Distribution.Solver.Modular.RetryLog
import Distribution.Solver.Modular.Tree
import Distribution.Solver.Types.PackagePath
import Distribution.Solver.Types.Settings (EnableBackjumping(..), CountConflicts(..))
import qualified Distribution.Solver.Types.Progress as P
-- | This function takes the variable we're currently considering, an
-- initial conflict set and a
......@@ -165,8 +164,7 @@ backjumpAndExplore :: EnableBackjumping
-> CountConflicts
-> Tree QGoalReason -> Log Message (Assignment, RevDepMap)
backjumpAndExplore enableBj countConflicts t =
toLog $ toProgress $
exploreLog enableBj countConflicts t (A M.empty M.empty M.empty) M.empty
toLog $ exploreLog enableBj countConflicts t (A M.empty M.empty M.empty) M.empty
where
toLog :: P.Progress step fail done -> Log step done
toLog = P.foldProgress P.Step (const (P.Fail ())) P.Done
toLog :: RetryLog step fail done -> Log step done
toLog = toProgress . mapFailure (const ())
......@@ -3,6 +3,7 @@ module Distribution.Solver.Modular.RetryLog
( RetryLog
, toProgress
, fromProgress
, mapFailure
, retry
, failWith
, succeedWith
......@@ -34,6 +35,12 @@ fromProgress l = RetryLog $ \f -> go f l
go f (Fail failure) = f failure
go f (Step m ms) = Step m (go f ms)
-- | /O(1)/. Apply a function to the failure value in a log.
mapFailure :: (fail1 -> fail2)
-> RetryLog step fail1 done
-> RetryLog step fail2 done
mapFailure f l = retry l $ \failure -> RetryLog $ \g -> g (f failure)
-- | /O(1)/. If the first log leads to failure, continue with the second.
retry :: RetryLog step fail1 done
-> (fail1 -> RetryLog step fail2 done)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment