Commit 07bb6d15 authored by Edward Z. Yang's avatar Edward Z. Yang
Browse files

Specialize and delete code not needed by SolverInstallPlan.



Now we monomorphize SolverInstallPlan so that its data structures
are non-parametric, and delete functions that are not needed.
Specifically:

    - GenericPlanPackage -> SolverPlanPackage, lose the
      type parameters, lose the Processing/Installed/Failed
      constructors (this makes some partial functions total! Yay!)

    - GenericInstallPlan -> SolverInstallPlan

    - PlanProblem -> SolverPlanProblem

    - Deleted ready, processing, completed, failed,
      preexisting
Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
parent a0891eba
......@@ -457,7 +457,7 @@ pruneInstallPlan pkgSpecifiers =
either (Fail . explain) Done
. SolverInstallPlan.remove (\pkg -> packageName pkg `elem` targetnames)
where
explain :: [SolverInstallPlan.PlanProblem ipkg srcpkg iresult ifailure] -> String
explain :: [SolverInstallPlan.SolverPlanProblem] -> String
explain problems =
"Cannot select only the dependencies (as requested by the "
++ "'--only-dependencies' flag), "
......
......@@ -796,8 +796,6 @@ configureInstallPlan solverPlan =
SolverInstallPlan.Configured pkg ->
Configured (configureSolverPackage mapDep pkg)
_ -> error "configureInstallPlan: unexpected package state"
where
configureSolverPackage :: (UnitId -> UnitId)
-> SolverPackage UnresolvedPkgLoc
......
......@@ -1025,8 +1025,6 @@ elaborateInstallPlan platform compiler compilerprogdb
InstallPlan.Configured
(elaborateSolverPackage mapDep pkg)
_ -> error "elaborateInstallPlan: unexpected package state"
elaborateSolverPackage :: (UnitId -> UnitId)
-> SolverPackage UnresolvedPkgLoc
-> ElaboratedConfiguredPackage
......
......@@ -48,7 +48,6 @@ import Language.Haskell.Extension (Extension(..), Language)
import Distribution.Client.Dependency
import Distribution.Client.Dependency.Types
import Distribution.Client.Types
import qualified Distribution.Client.InstallPlan as CI.InstallPlan
import qualified Distribution.Client.SolverInstallPlan as CI.SolverInstallPlan
import Distribution.Solver.Types.ComponentDeps (ComponentDeps)
......@@ -473,10 +472,10 @@ exResolve db exts langs pkgConfigDb targets solver mbj indepGoals reorder
extractInstallPlan :: CI.SolverInstallPlan.SolverInstallPlan
-> [(ExamplePkgName, ExamplePkgVersion)]
extractInstallPlan = catMaybes . map confPkg . CI.InstallPlan.toList
extractInstallPlan = catMaybes . map confPkg . CI.SolverInstallPlan.toList
where
confPkg :: CI.SolverInstallPlan.SolverPlanPackage -> Maybe (String, Int)
confPkg (CI.InstallPlan.Configured pkg) = Just $ srcPkg pkg
confPkg (CI.SolverInstallPlan.Configured pkg) = Just $ srcPkg pkg
confPkg _ = Nothing
srcPkg :: SolverPackage UnresolvedPkgLoc -> (String, Int)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment