@@ -32,17 +32,20 @@ import qualified Distribution.Client.Dependency.Types as T
32
32
-- return it immediately. If all children contain conflict sets, we can
33
33
-- take the union as the combined conflict set.
34
34
backjump :: F. Foldable t => Var QPN -> t (ConflictSetLog a ) -> ConflictSetLog a
35
- backjump var xs = F. foldr combine backjumpInfo xs S. empty
35
+ backjump var xs = F. foldr combine logBackjump xs S. empty
36
36
where
37
37
combine :: ConflictSetLog a
38
38
-> (ConflictSet QPN -> ConflictSetLog a )
39
39
-> ConflictSet QPN -> ConflictSetLog a
40
40
combine (T. Done x) _ _ = T. Done x
41
41
combine (T. Fail cs) f csAcc
42
- | not (simplifyVar var `S.member` cs) = backjumpInfo cs
42
+ | not (simplifyVar var `S.member` cs) = logBackjump cs
43
43
| otherwise = f (csAcc `S.union` cs)
44
44
combine (T. Step m ms) f cs = T. Step m (combine ms f cs)
45
45
46
+ logBackjump :: ConflictSet QPN -> ConflictSetLog a
47
+ logBackjump cs = failWith (Failure cs Backjump ) cs
48
+
46
49
type ConflictSetLog = T. Progress Message (ConflictSet QPN )
47
50
48
51
-- | A tree traversal that simultaneously propagates conflict sets up
@@ -77,15 +80,6 @@ exploreLog = cata go
77
80
(failWith (Failure S. empty EmptyGoalChoice ) S. empty) -- empty goal choice is an internal error
78
81
(\ k v _xs -> continueWith (Next (close k)) (v a)) -- commit to the first goal choice
79
82
80
- -- | Add in information about pruned trees.
81
- --
82
- -- TODO: This isn't quite optimal, because we do not merely report the shape of the
83
- -- tree, but rather make assumptions about where that shape originated from. It'd be
84
- -- better if the pruning itself would leave information that we could pick up at this
85
- -- point.
86
- backjumpInfo :: ConflictSet QPN -> ConflictSetLog a
87
- backjumpInfo cs = failWith (Failure cs Backjump ) cs
88
-
89
83
-- | Interface.
90
84
backjumpAndExplore :: Tree a -> Log Message (Assignment , RevDepMap )
91
85
backjumpAndExplore t = toLog $ exploreLog t (A M. empty M. empty M. empty)
0 commit comments