Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
09ea8356
Commit
09ea8356
authored
May 07, 2008
by
Duncan Coutts
Browse files
Add lookupConfiguredPackage helper function to InstallPlan
Simplifies implementation of completed and failed
parent
22929525
Changes
1
Hide whitespace changes
Inline
Side-by-side
cabal-install/Hackage/InstallPlan.hs
View file @
09ea8356
...
...
@@ -232,10 +232,9 @@ next plan@(InstallPlan { planIndex = index }) = assert (invariant plan) $
completed
::
PackageIdentifier
->
InstallPlan
buildResult
->
InstallPlan
buildResult
completed
pkgid
plan
=
case
PackageIndex
.
lookupPackageId
index
pkgid
of
Just
(
Configured
cp
)
->
plan
{
planIndex
=
PackageIndex
.
insert
(
Installed
cp
)
index
}
_
->
error
"InstallPlan.completed: internal error; cannot mark package as completed"
where
index
=
planIndex
plan
plan
{
planIndex
=
PackageIndex
.
insert
installed
(
planIndex
plan
)
}
where
installed
=
Installed
(
lookupConfiguredPackage
plan
pkgid
)
-- | Marks a package in the graph as having failed. It also marks all the
-- packages that depended on it as having failed.
...
...
@@ -268,6 +267,16 @@ failed pkgid buildResult dependentBuildResult
in
foldr
markDepsAsFailed
index''
deps
_
->
index'
-- | lookup a package that we expect to be in the configured state
--
lookupConfiguredPackage
::
InstallPlan
a
->
PackageIdentifier
->
ConfiguredPackage
lookupConfiguredPackage
plan
pkgid
=
case
PackageIndex
.
lookupPackageId
(
planIndex
plan
)
pkgid
of
Just
(
Configured
pkg
)
->
pkg
Just
_
->
error
$
"InstallPlan: not configured "
++
display
pkgid
Nothing
->
error
$
"InstallPlan: no such package "
++
display
pkgid
-- ------------------------------------------------------------
-- * Checking valididy of plans
-- ------------------------------------------------------------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment