Commit 628a5d55 authored by Mikhail Glushenkov's avatar Mikhail Glushenkov

Make type signatures less verbose.

parent 62c8c778
......@@ -36,8 +36,6 @@ import Distribution.Package
( PackageId, packageId )
import Distribution.PackageDescription
( FlagAssignment )
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.Simple.InstallDirs
( PathTemplate, fromPathTemplate
, initialPathTemplateEnv, substPathTemplate )
......@@ -119,9 +117,7 @@ storeLocal cinfo templates reports platform = sequence_
-- ------------------------------------------------------------
fromInstallPlan :: Platform -> CompilerId
-> InstallPlan InstalledPackageInfo
ConfiguredPackage
BuildSuccess BuildFailure
-> InstallPlan
-> [(BuildReport, Maybe Repo)]
fromInstallPlan platform comp plan =
catMaybes
......@@ -130,9 +126,7 @@ fromInstallPlan platform comp plan =
$ plan
fromPlanPackage :: Platform -> CompilerId
-> InstallPlan.PlanPackage InstalledPackageInfo
ConfiguredPackage
BuildSuccess BuildFailure
-> InstallPlan.PlanPackage
-> Maybe (BuildReport, Maybe Repo)
fromPlanPackage (Platform arch os) comp planPackage = case planPackage of
InstallPlan.Installed (ReadyPackage (ConfiguredPackage srcPkg flags _ _) deps)
......
......@@ -42,7 +42,6 @@ import Distribution.Simple.Setup
import Distribution.Simple.PackageIndex (InstalledPackageIndex)
import Distribution.Simple.Utils
( defaultPackageDesc )
import Distribution.InstalledPackageInfo (InstalledPackageInfo)
import qualified Distribution.InstalledPackageInfo as Installed
import Distribution.Package
( Package(..), InstalledPackageId, packageName
......@@ -131,8 +130,7 @@ configure verbosity packageDBs repos comp platform conf
where
setupScriptOptions :: InstalledPackageIndex
-> Maybe (ReadyPackage ConfiguredPackage
InstalledPackageInfo)
-> Maybe ReadyPackage
-> SetupScriptOptions
setupScriptOptions =
configureSetupScript
......@@ -160,8 +158,7 @@ configureSetupScript :: PackageDBStack
-> Maybe Lock
-> Bool
-> InstalledPackageIndex
-> Maybe (ReadyPackage ConfiguredPackage
InstalledPackageInfo)
-> Maybe ReadyPackage
-> SetupScriptOptions
configureSetupScript packageDBs
comp
......@@ -232,10 +229,7 @@ planLocalPackage :: Verbosity -> Compiler
-> ConfigFlags -> ConfigExFlags
-> InstalledPackageIndex
-> SourcePackageDb
-> IO (Progress String String
(InstallPlan InstalledPackageInfo
ConfiguredPackage
iresult ifailure))
-> IO (Progress String String InstallPlan)
planLocalPackage verbosity comp platform configFlags configExFlags installedPkgIndex
(SourcePackageDb _ packagePrefs) = do
pkg <- readPackageDescription verbosity =<< defaultPackageDesc verbosity
......@@ -301,7 +295,7 @@ configurePackage :: Verbosity
-> Platform -> CompilerInfo
-> SetupScriptOptions
-> ConfigFlags
-> ReadyPackage ConfiguredPackage InstalledPackageInfo
-> ReadyPackage
-> [String]
-> IO ()
configurePackage verbosity platform comp scriptOptions configFlags
......
......@@ -83,8 +83,6 @@ import Distribution.Client.Targets
import Distribution.Client.ComponentDeps (ComponentDeps)
import qualified Distribution.Client.ComponentDeps as CD
import qualified Distribution.InstalledPackageInfo as Installed
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.Package
( PackageName(..), PackageIdentifier(PackageIdentifier), PackageId
, Package(..), packageName, packageVersion
......@@ -525,10 +523,7 @@ resolveDependencies :: Platform
-> CompilerInfo
-> Solver
-> DepResolverParams
-> Progress String String
(InstallPlan InstalledPackageInfo
ConfiguredPackage
iresult ifailure)
-> Progress String String InstallPlan
--TODO: is this needed here? see dontUpgradeNonUpgradeablePackages
resolveDependencies platform comp _solver params
......@@ -613,9 +608,7 @@ validateSolverResult :: Platform
-> CompilerInfo
-> Bool
-> [ResolverPackage]
-> InstallPlan InstalledPackageInfo
ConfiguredPackage
iresult ifailure
-> InstallPlan
validateSolverResult platform comp indepGoals pkgs =
case planPackagesProblems platform comp pkgs of
[] -> case InstallPlan.new indepGoals index of
......
......@@ -36,10 +36,7 @@ import Distribution.Client.Sandbox.Types
( SandboxPackageInfo(..) )
import Distribution.Package
( Package, packageId, packageName, packageVersion
, HasInstalledPackageId )
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
( Package, packageId, packageName, packageVersion )
import Distribution.Simple.Compiler
( Compiler, compilerInfo, PackageDBStack )
import Distribution.Simple.PackageIndex (InstalledPackageIndex)
......@@ -133,9 +130,7 @@ planPackages :: Verbosity
-> InstalledPackageIndex
-> SourcePackageDb
-> [PackageSpecifier SourcePackage]
-> IO [PlanPackage InstalledPackageInfo
ConfiguredPackage
iresult ifailure]
-> IO [PlanPackage]
planPackages verbosity comp platform mSandboxPkgInfo freezeFlags
installedPkgIndex sourcePkgDb pkgSpecifiers = do
......@@ -198,11 +193,9 @@ planPackages verbosity comp platform mSandboxPkgInfo freezeFlags
-- 2) not a dependency (directly or transitively) of the package we are
-- freezing. This is useful for removing previously installed packages
-- which are no longer required from the install plan.
pruneInstallPlan :: (HasInstalledPackageId ipkg, PackageFixedDeps ipkg,
HasInstalledPackageId srcpkg, PackageFixedDeps srcpkg)
=> InstallPlan ipkg srcpkg iresult ifailure
pruneInstallPlan :: InstallPlan
-> [PackageSpecifier SourcePackage]
-> [PlanPackage ipkg srcpkg iresult ifailure]
-> [PlanPackage]
pruneInstallPlan installPlan pkgSpecifiers =
either (const brokenPkgsErr)
(removeSelf pkgIds . PackageIndex.allPackages) $
......
......@@ -145,8 +145,6 @@ import Distribution.PackageDescription
, FlagName(..), FlagAssignment )
import Distribution.PackageDescription.Configuration
( finalizePackageDescription )
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.ParseUtils
( showPWarning )
import Distribution.Version
......@@ -283,10 +281,7 @@ makeInstallContext verbosity
-- | Make an install plan given install context and install arguments.
makeInstallPlan :: Verbosity -> InstallArgs -> InstallContext
-> IO (Progress String String
(InstallPlan InstalledPackageInfo
ConfiguredPackage
iresult ifailure))
-> IO (Progress String String InstallPlan)
makeInstallPlan verbosity
(_, _, comp, platform, _, _, mSandboxPkgInfo,
_, configFlags, configExFlags, installFlags,
......@@ -303,9 +298,7 @@ makeInstallPlan verbosity
-- | Given an install plan, perform the actual installations.
processInstallPlan :: Verbosity -> InstallArgs -> InstallContext
-> InstallPlan InstalledPackageInfo
ConfiguredPackage
BuildSuccess BuildFailure
-> InstallPlan
-> IO ()
processInstallPlan verbosity
args@(_,_, _, _, _, _, _, _, _, _, installFlags, _)
......@@ -336,10 +329,7 @@ planPackages :: Compiler
-> InstalledPackageIndex
-> SourcePackageDb
-> [PackageSpecifier SourcePackage]
-> Progress String String
(InstallPlan InstalledPackageInfo
ConfiguredPackage
iresult ifailure)
-> Progress String String InstallPlan
planPackages comp platform mSandboxPkgInfo solver
configFlags configExFlags installFlags
installedPkgIndex sourcePkgDb pkgSpecifiers =
......@@ -419,13 +409,10 @@ planPackages comp platform mSandboxPkgInfo solver
allowNewer = fromFlag (configAllowNewer configExFlags)
-- | Remove the provided targets from the install plan.
pruneInstallPlan :: (Package targetpkg, Package srcpkg, Package ipkg,
PackageFixedDeps srcpkg, PackageFixedDeps ipkg,
HasInstalledPackageId srcpkg, HasInstalledPackageId ipkg)
pruneInstallPlan :: Package targetpkg
=> [PackageSpecifier targetpkg]
-> InstallPlan ipkg srcpkg iresult ifailure
-> Progress String String
(InstallPlan ipkg srcpkg iresult ifailure)
-> InstallPlan
-> Progress String String InstallPlan
pruneInstallPlan pkgSpecifiers =
-- TODO: this is a general feature and should be moved to D.C.Dependency
-- Also, the InstallPlan.remove should return info more precise to the
......@@ -459,9 +446,7 @@ pruneInstallPlan pkgSpecifiers =
-- either requested or needed.
checkPrintPlan :: Verbosity
-> InstalledPackageIndex
-> InstallPlan InstalledPackageInfo
ConfiguredPackage
BuildSuccess ifailure
-> InstallPlan
-> SourcePackageDb
-> InstallFlags
-> [PackageSpecifier SourcePackage]
......@@ -552,11 +537,9 @@ checkPrintPlan verbosity installed installPlan sourcePkgDb
overrideReinstall = fromFlag (installOverrideReinstall installFlags)
--TODO: this type is too specific
linearizeInstallPlan :: (PackageFixedDeps srcpkg, HasInstalledPackageId srcpkg)
=> InstalledPackageIndex
-> InstallPlan InstalledPackageInfo srcpkg
BuildSuccess ifailure
-> [(ReadyPackage srcpkg InstalledPackageInfo, PackageStatus)]
linearizeInstallPlan :: InstalledPackageIndex
-> InstallPlan
-> [(ReadyPackage, PackageStatus)]
linearizeInstallPlan installedPkgIndex plan =
unfoldr next plan
where
......@@ -588,9 +571,8 @@ extractReinstalls :: PackageStatus -> [InstalledPackageId]
extractReinstalls (Reinstall ipids _) = ipids
extractReinstalls _ = []
packageStatus :: (Package srcpkg, HasInstalledPackageId ipkg)
=> InstalledPackageIndex
-> ReadyPackage srcpkg ipkg
packageStatus :: InstalledPackageIndex
-> ReadyPackage
-> PackageStatus
packageStatus installedPkgIndex cpkg =
case PackageIndex.lookupPackageName installedPkgIndex
......@@ -604,9 +586,8 @@ packageStatus installedPkgIndex cpkg =
where
changes :: (Package srcpkg, HasInstalledPackageId ipkg)
=> Installed.InstalledPackageInfo
-> ReadyPackage srcpkg ipkg
changes :: Installed.InstalledPackageInfo
-> ReadyPackage
-> [MergeResult PackageIdentifier PackageIdentifier]
changes pkg pkg' = filter changed $
mergeBy (comparing packageName)
......@@ -627,7 +608,7 @@ packageStatus installedPkgIndex cpkg =
printPlan :: Bool -- is dry run
-> Verbosity
-> [(ReadyPackage ConfiguredPackage ipkg, PackageStatus)]
-> [(ReadyPackage, PackageStatus)]
-> SourcePackageDb
-> IO ()
printPlan dryRun verbosity plan sourcePkgDb = case plan of
......@@ -784,9 +765,7 @@ theSpecifiedPackage pkgSpec =
postInstallActions :: Verbosity
-> InstallArgs
-> [UserTarget]
-> InstallPlan InstalledPackageInfo
ConfiguredPackage
BuildSuccess BuildFailure
-> InstallPlan
-> IO ()
postInstallActions verbosity
(packageDBs, _, comp, platform, conf, useSandbox, mSandboxPkgInfo
......@@ -867,7 +846,7 @@ regenerateHaddockIndex :: Verbosity
-> UseSandbox
-> ConfigFlags
-> InstallFlags
-> InstallPlan ipkg srcpkg BuildSuccess ifailure
-> InstallPlan
-> IO ()
regenerateHaddockIndex verbosity packageDBs comp platform conf useSandbox
configFlags installFlags installPlan
......@@ -926,9 +905,7 @@ symlinkBinaries :: Verbosity
-> Platform -> Compiler
-> ConfigFlags
-> InstallFlags
-> InstallPlan InstalledPackageInfo
ConfiguredPackage
iresult ifailure
-> InstallPlan
-> IO ()
symlinkBinaries verbosity platform comp configFlags installFlags plan = do
failed <- InstallSymlink.symlinkBinaries platform comp
......@@ -955,8 +932,7 @@ symlinkBinaries verbosity platform comp configFlags installFlags plan = do
bindir = fromFlag (installSymlinkBinDir installFlags)
printBuildFailures :: Package srcpkg
=> InstallPlan ipkg srcpkg iresult BuildFailure
printBuildFailures :: InstallPlan
-> IO ()
printBuildFailures plan =
case [ (pkg, reason)
......@@ -1002,8 +978,7 @@ printBuildFailures plan =
-- update the timestamps of those deps.
updateSandboxTimestampsFile :: UseSandbox -> Maybe SandboxPackageInfo
-> Compiler -> Platform
-> InstallPlan ipkg ConfiguredPackage
iresult ifailure
-> InstallPlan
-> IO ()
updateSandboxTimestampsFile (UseSandbox sandboxDir)
(Just (SandboxPackageInfo _ _ _ allAddSourceDeps))
......@@ -1036,12 +1011,8 @@ type UseLogFile = Maybe (PackageIdentifier -> LibraryName -> FilePath, Verbosity
performInstallations :: Verbosity
-> InstallArgs
-> InstalledPackageIndex
-> InstallPlan InstalledPackageInfo
ConfiguredPackage
BuildSuccess BuildFailure
-> IO (InstallPlan InstalledPackageInfo
ConfiguredPackage
BuildSuccess BuildFailure)
-> InstallPlan
-> IO InstallPlan
performInstallations verbosity
(packageDBs, _, comp, platform, conf, useSandbox, _,
globalFlags, configFlags, configExFlags, installFlags, haddockFlags)
......@@ -1158,15 +1129,9 @@ executeInstallPlan :: Verbosity
-> Compiler
-> JobControl IO (PackageId, LibraryName, BuildResult)
-> UseLogFile
-> InstallPlan InstalledPackageInfo
ConfiguredPackage
BuildSuccess BuildFailure
-> (ReadyPackage ConfiguredPackage
InstalledPackageInfo
-> IO BuildResult)
-> IO (InstallPlan InstalledPackageInfo
ConfiguredPackage
BuildSuccess BuildFailure)
-> InstallPlan
-> (ReadyPackage -> IO BuildResult)
-> IO InstallPlan
executeInstallPlan verbosity comp jobCtl useLogFile plan0 installPkg =
tryNewTasks 0 plan0
where
......@@ -1196,11 +1161,8 @@ executeInstallPlan verbosity comp jobCtl useLogFile plan0 installPkg =
plan' = updatePlan pkgid buildResult plan
tryNewTasks taskCount' plan'
updatePlan :: PackageIdentifier -> BuildResult
-> InstallPlan InstalledPackageInfo ConfiguredPackage
BuildSuccess BuildFailure
-> InstallPlan InstalledPackageInfo ConfiguredPackage
BuildSuccess BuildFailure
updatePlan :: PackageIdentifier -> BuildResult -> InstallPlan
-> InstallPlan
updatePlan pkgid (Right buildSuccess@(BuildOk _ _ mipkg)) =
InstallPlan.completed (Source.fakeInstalledPackageId pkgid)
mipkg buildSuccess
......@@ -1243,8 +1205,7 @@ executeInstallPlan verbosity comp jobCtl useLogFile plan0 installPkg =
-- 'configurePackage' in D.C.Configure.
installReadyPackage :: Platform -> CompilerInfo
-> ConfigFlags
-> ReadyPackage ConfiguredPackage
InstalledPackageInfo
-> ReadyPackage
-> (ConfigFlags -> PackageLocation (Maybe FilePath)
-> PackageDescription
-> PackageDescriptionOverride
......
......@@ -14,7 +14,9 @@
-----------------------------------------------------------------------------
module Distribution.Client.InstallPlan (
InstallPlan,
PlanPackage(..),
GenericInstallPlan,
PlanPackage,
GenericPlanPackage(..),
-- * Operations on 'InstallPlan's
new,
......@@ -42,11 +44,15 @@ module Distribution.Client.InstallPlan (
dependencyClosure,
) where
import Distribution.InstalledPackageInfo
( InstalledPackageInfo )
import Distribution.Package
( PackageIdentifier(..), PackageName(..), Package(..)
, InstalledPackageId, HasInstalledPackageId(..) )
import Distribution.Client.Types
( PackageFixedDeps(..), ReadyPackage(..), fakeInstalledPackageId )
( BuildSuccess, BuildFailure
, PackageFixedDeps(..), ConfiguredPackage
, GenericReadyPackage(..), fakeInstalledPackageId )
import Distribution.Version
( Version )
import Distribution.Client.ComponentDeps (ComponentDeps)
......@@ -117,24 +123,28 @@ import qualified Data.Traversable as T
-- | Packages in an install plan
--
-- NOTE: 'ConfiguredPackage', 'ReadyPackage' and 'PlanPackage' intentionally
-- have no 'PackageInstalled' instance. `This is important: PackageInstalled
-- returns only library dependencies, but for package that aren't yet installed
-- we know many more kinds of dependencies (setup dependencies, exe, test-suite,
-- benchmark, ..). Any functions that operate on dependencies in cabal-install
-- should consider what to do with these dependencies; if we give a
-- 'PackageInstalled' instance it would be too easy to get this wrong (and,
-- for instance, call graph traversal functions from Cabal rather than from
-- cabal-install). Instead, see 'PackageFixedDeps'.
data PlanPackage ipkg srcpkg iresult ifailure
-- NOTE: 'ConfiguredPackage', 'GenericReadyPackage' and 'GenericPlanPackage'
-- intentionally have no 'PackageInstalled' instance. `This is important:
-- PackageInstalled returns only library dependencies, but for package that
-- aren't yet installed we know many more kinds of dependencies (setup
-- dependencies, exe, test-suite, benchmark, ..). Any functions that operate on
-- dependencies in cabal-install should consider what to do with these
-- dependencies; if we give a 'PackageInstalled' instance it would be too easy
-- to get this wrong (and, for instance, call graph traversal functions from
-- Cabal rather than from cabal-install). Instead, see 'PackageFixedDeps'.
data GenericPlanPackage ipkg srcpkg iresult ifailure
= PreExisting ipkg
| Configured srcpkg
| Processing (ReadyPackage srcpkg ipkg)
| Installed (ReadyPackage srcpkg ipkg) (Maybe ipkg) iresult
| Processing (GenericReadyPackage srcpkg ipkg)
| Installed (GenericReadyPackage srcpkg ipkg) (Maybe ipkg) iresult
| Failed srcpkg ifailure
type PlanPackage = GenericPlanPackage
InstalledPackageInfo ConfiguredPackage
BuildSuccess BuildFailure
instance (Package ipkg, Package srcpkg) =>
Package (PlanPackage ipkg srcpkg iresult ifailure) where
Package (GenericPlanPackage ipkg srcpkg iresult ifailure) where
packageId (PreExisting ipkg) = packageId ipkg
packageId (Configured spkg) = packageId spkg
packageId (Processing rpkg) = packageId rpkg
......@@ -143,7 +153,7 @@ instance (Package ipkg, Package srcpkg) =>
instance (PackageFixedDeps srcpkg,
PackageFixedDeps ipkg, HasInstalledPackageId ipkg) =>
PackageFixedDeps (PlanPackage ipkg srcpkg iresult ifailure) where
PackageFixedDeps (GenericPlanPackage ipkg srcpkg iresult ifailure) where
depends (PreExisting pkg) = depends pkg
depends (Configured pkg) = depends pkg
depends (Processing pkg) = depends pkg
......@@ -151,7 +161,8 @@ instance (PackageFixedDeps srcpkg,
depends (Failed pkg _) = depends pkg
instance (HasInstalledPackageId ipkg, HasInstalledPackageId srcpkg) =>
HasInstalledPackageId (PlanPackage ipkg srcpkg iresult ifailure) where
HasInstalledPackageId
(GenericPlanPackage ipkg srcpkg iresult ifailure) where
installedPackageId (PreExisting ipkg ) = installedPackageId ipkg
installedPackageId (Configured spkg) = installedPackageId spkg
installedPackageId (Processing rpkg) = installedPackageId rpkg
......@@ -161,22 +172,28 @@ instance (HasInstalledPackageId ipkg, HasInstalledPackageId srcpkg) =>
installedPackageId (Failed spkg _) = installedPackageId spkg
data InstallPlan ipkg srcpkg iresult ifailure = InstallPlan {
data GenericInstallPlan ipkg srcpkg iresult ifailure = GenericInstallPlan {
planIndex :: (PlanIndex ipkg srcpkg iresult ifailure),
planFakeMap :: FakeMap,
planGraph :: Graph,
planGraphRev :: Graph,
planPkgOf :: Graph.Vertex -> PlanPackage ipkg srcpkg iresult ifailure,
planPkgOf :: Graph.Vertex
-> GenericPlanPackage ipkg srcpkg iresult ifailure,
planVertexOf :: InstalledPackageId -> Graph.Vertex,
planIndepGoals :: Bool
}
-- | 'GenericInstallPlan' specialised to most commonly used types.
type InstallPlan = GenericInstallPlan
InstalledPackageInfo ConfiguredPackage
BuildSuccess BuildFailure
type PlanIndex ipkg srcpkg iresult ifailure =
PackageIndex (PlanPackage ipkg srcpkg iresult ifailure)
PackageIndex (GenericPlanPackage ipkg srcpkg iresult ifailure)
invariant :: (HasInstalledPackageId ipkg, PackageFixedDeps ipkg,
HasInstalledPackageId srcpkg, PackageFixedDeps srcpkg)
=> InstallPlan ipkg srcpkg iresult ifailure -> Bool
=> GenericInstallPlan ipkg srcpkg iresult ifailure -> Bool
invariant plan =
valid (planFakeMap plan)
(planIndepGoals plan)
......@@ -195,13 +212,13 @@ showPlanIndex index =
++ display (installedPackageId p) ++ ")"
showInstallPlan :: (HasInstalledPackageId ipkg, HasInstalledPackageId srcpkg)
=> InstallPlan ipkg srcpkg iresult ifailure -> String
=> GenericInstallPlan ipkg srcpkg iresult ifailure -> String
showInstallPlan plan =
showPlanIndex (planIndex plan) ++ "\n" ++
"fake map:\n " ++ intercalate "\n " (map showKV (Map.toList (planFakeMap plan)))
where showKV (k,v) = display k ++ " -> " ++ display v
showPlanPackageTag :: PlanPackage ipkg srcpkg iresult ifailure -> String
showPlanPackageTag :: GenericPlanPackage ipkg srcpkg iresult ifailure -> String
showPlanPackageTag (PreExisting _) = "PreExisting"
showPlanPackageTag (Configured _) = "Configured"
showPlanPackageTag (Processing _) = "Processing"
......@@ -215,7 +232,7 @@ new :: (HasInstalledPackageId ipkg, PackageFixedDeps ipkg,
=> Bool
-> PlanIndex ipkg srcpkg iresult ifailure
-> Either [PlanProblem ipkg srcpkg iresult ifailure]
(InstallPlan ipkg srcpkg iresult ifailure)
(GenericInstallPlan ipkg srcpkg iresult ifailure)
new indepGoals index =
-- NB: Need to pre-initialize the fake-map with pre-existing
-- packages
......@@ -226,7 +243,7 @@ new indepGoals index =
. filter isPreExisting
$ PackageIndex.allPackages index in
case problems fakeMap indepGoals index of
[] -> Right InstallPlan {
[] -> Right GenericInstallPlan {
planIndex = index,
planFakeMap = fakeMap,
planGraph = graph,
......@@ -240,8 +257,8 @@ new indepGoals index =
noSuchPkgId = internalError "package is not in the graph"
probs -> Left probs
toList :: InstallPlan ipkg srcpkg iresult ifailure
-> [PlanPackage ipkg srcpkg iresult ifailure]
toList :: GenericInstallPlan ipkg srcpkg iresult ifailure
-> [GenericPlanPackage ipkg srcpkg iresult ifailure]
toList = PackageIndex.allPackages . planIndex
-- | Remove packages from the install plan. This will result in an
......@@ -252,10 +269,10 @@ toList = PackageIndex.allPackages . planIndex
--
remove :: (HasInstalledPackageId ipkg, PackageFixedDeps ipkg,
HasInstalledPackageId srcpkg, PackageFixedDeps srcpkg)
=> (PlanPackage ipkg srcpkg iresult ifailure -> Bool)
-> InstallPlan ipkg srcpkg iresult ifailure
=> (GenericPlanPackage ipkg srcpkg iresult ifailure -> Bool)
-> GenericInstallPlan ipkg srcpkg iresult ifailure
-> Either [PlanProblem ipkg srcpkg iresult ifailure]
(InstallPlan ipkg srcpkg iresult ifailure)
(GenericInstallPlan ipkg srcpkg iresult ifailure)
remove shouldRemove plan =
new (planIndepGoals plan) newIndex
where
......@@ -267,8 +284,8 @@ remove shouldRemove plan =
-- The plan is complete if the result is @[]@.
--
ready :: forall ipkg srcpkg iresult ifailure. PackageFixedDeps srcpkg
=> InstallPlan ipkg srcpkg iresult ifailure
-> [ReadyPackage srcpkg ipkg]
=> GenericInstallPlan ipkg srcpkg iresult ifailure
-> [GenericReadyPackage srcpkg ipkg]
ready plan = assert check readyPackages
where
check = if null readyPackages && null processingPackages
......@@ -277,7 +294,7 @@ ready plan = assert check readyPackages
configuredPackages = [ pkg | Configured pkg <- toList plan ]
processingPackages = [ pkg | Processing pkg <- toList plan]
readyPackages :: [ReadyPackage srcpkg ipkg]
readyPackages :: [GenericReadyPackage srcpkg ipkg]
readyPackages =
[ ReadyPackage srcpkg deps
| srcpkg <- configuredPackages
......@@ -310,9 +327,9 @@ ready plan = assert check readyPackages
--
processing :: (HasInstalledPackageId ipkg, PackageFixedDeps ipkg,
HasInstalledPackageId srcpkg, PackageFixedDeps srcpkg)
=> [ReadyPackage srcpkg ipkg]
-> InstallPlan ipkg srcpkg iresult ifailure
-> InstallPlan ipkg srcpkg iresult ifailure
=> [GenericReadyPackage srcpkg ipkg]
-> GenericInstallPlan ipkg srcpkg iresult ifailure
-> GenericInstallPlan ipkg srcpkg iresult ifailure
processing pkgs plan = assert (invariant plan') plan'
where
plan' = plan {
......@@ -330,8 +347,8 @@ completed :: (HasInstalledPackageId ipkg, PackageFixedDeps ipkg,
HasInstalledPackageId srcpkg, PackageFixedDeps srcpkg)
=> InstalledPackageId
-> Maybe ipkg -> iresult
-> InstallPlan ipkg srcpkg iresult ifailure
-> InstallPlan ipkg srcpkg iresult ifailure
-> GenericInstallPlan ipkg srcpkg iresult ifailure
-> GenericInstallPlan ipkg srcpkg iresult ifailure
completed pkgid mipkg buildResult plan = assert (invariant plan') plan'
where
plan' = plan {
......@@ -360,8 +377,8 @@ failed :: (HasInstalledPackageId ipkg, PackageFixedDeps ipkg,
=> InstalledPackageId -- ^ The id of the package that failed to install
-> ifailure -- ^ The build result to use for the failed package
-> ifailure -- ^ The build result to use for its dependencies
-> InstallPlan ipkg srcpkg iresult ifailure
-> InstallPlan ipkg srcpkg iresult ifailure
-> GenericInstallPlan ipkg srcpkg iresult ifailure
-> GenericInstallPlan ipkg srcpkg iresult ifailure
failed pkgid buildResult buildResult' plan = assert (invariant plan') plan'
where
-- NB: failures don't update IPIDs
......@@ -377,9 +394,9 @@ failed pkgid buildResult buildResult' plan = assert (invariant plan') plan'
-- | Lookup the reachable packages in the reverse dependency graph.
--
packagesThatDependOn :: InstallPlan ipkg srcpkg iresult ifailure
packagesThatDependOn :: GenericInstallPlan ipkg srcpkg iresult ifailure
-> InstalledPackageId
-> [PlanPackage ipkg srcpkg iresult ifailure]
-> [GenericPlanPackage ipkg srcpkg iresult ifailure]
packagesThatDependOn plan pkgid = map (planPkgOf plan)
. tail
. Graph.reachable (planGraphRev plan)
......@@ -388,9 +405,9 @@ packagesThatDependOn plan pkgid = map (planPkgOf plan)