@@ -584,36 +584,25 @@ fromSolverInstallPlanWithProgress
584584 -> SolverInstallPlan
585585 -> LogProgress (GenericInstallPlan ipkg srcpkg )
586586fromSolverInstallPlanWithProgress f plan = do
587- (_, _, pkgs'') <-
587+ (_, pkgs'') <-
588588 foldM
589589 f'
590- (Map. empty, Map. empty, [] )
590+ (Map. empty, [] )
591591 (SolverInstallPlan. reverseTopologicalOrder plan)
592592 return $
593593 mkInstallPlan
594594 " fromSolverInstallPlanWithProgress"
595595 (Graph. fromDistinctList pkgs'')
596596 where
597- f' (pidMap, ipiMap, pkgs) pkg = do
598- pkgs' <- f (mapDep pidMap ipiMap) pkg
599- let (pidMap', ipiMap') =
600- case nodeKey pkg of
601- -- FIXME: stage is ignored
602- PreExistingId _stage _ uid -> (pidMap, Map. insert uid pkgs' ipiMap)
603- PlannedId _stage pid -> (Map. insert pid pkgs' pidMap, ipiMap)
604- return (pidMap', ipiMap', pkgs' ++ pkgs)
597+ f' (pMap, pkgs) pkg = do
598+ pkgs' <- f (mapDep pMap) pkg
599+ let pMap' = Map. insert (nodeKey pkg) pkgs' pMap
600+ return (pMap', pkgs' ++ pkgs)
605601
606602 -- The error below shouldn't happen, since mapDep should only
607603 -- be called on neighbor SolverId, which must have all been done
608604 -- already by the reverse top-sort (we assume the graph is not broken).
609- --
610- -- FIXME: stage is ignored
611- mapDep _ ipiMap (PreExistingId _stage _pid uid)
612- | Just pkgs <- Map. lookup uid ipiMap = pkgs
613- | otherwise = error (" fromSolverInstallPlan: PreExistingId " ++ prettyShow uid)
614- mapDep pidMap _ (PlannedId _stage pid)
615- | Just pkgs <- Map. lookup pid pidMap = pkgs
616- | otherwise = error (" fromSolverInstallPlan: PlannedId " ++ prettyShow pid)
605+ mapDep pMap key = fromMaybe (error (" fromSolverInstallPlanWithProgress: " ++ prettyShow key)) (Map. lookup key pMap)
617606
618607-- | Conversion of 'SolverInstallPlan' to 'InstallPlan'.
619608-- Similar to 'elaboratedInstallPlan'
0 commit comments