Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
9d91e201
Commit
9d91e201
authored
Mar 14, 2016
by
Duncan Coutts
Committed by
Mikhail Glushenkov
Mar 27, 2016
Browse files
Split out reusable lookupReadyPackage util in InstallPlan
Used in the next patch. (cherry picked from commit
150c3189
)
parent
352f5795
Changes
1
Hide whitespace changes
Inline
Side-by-side
cabal-install/Distribution/Client/InstallPlan.hs
View file @
9d91e201
...
...
@@ -78,7 +78,7 @@ import Distribution.Text
import
Data.List
(
foldl'
,
intercalate
)
import
Data.Maybe
(
fromMaybe
,
maybeToList
)
(
fromMaybe
,
catMaybes
)
import
qualified
Data.Graph
as
Graph
import
Data.Graph
(
Graph
)
import
qualified
Data.Tree
as
Tree
...
...
@@ -86,7 +86,6 @@ import Distribution.Compat.Binary (Binary(..))
import
GHC.Generics
import
Control.Exception
(
assert
)
import
Data.Maybe
(
catMaybes
)
import
qualified
Data.Map
as
Map
import
qualified
Data.Traversable
as
T
...
...
@@ -358,12 +357,17 @@ ready plan = assert check readyPackages
processingPackages
=
[
pkg
|
Processing
pkg
<-
toList
plan
]
readyPackages
::
[
GenericReadyPackage
srcpkg
ipkg
]
readyPackages
=
[
ReadyPackage
srcpkg
deps
|
srcpkg
<-
configuredPackages
-- select only the package that have all of their deps installed:
,
deps
<-
maybeToList
(
hasAllInstalledDeps
srcpkg
)
]
readyPackages
=
catMaybes
(
map
(
lookupReadyPackage
plan
)
configuredPackages
)
lookupReadyPackage
::
forall
ipkg
srcpkg
iresult
ifailure
.
PackageFixedDeps
srcpkg
=>
GenericInstallPlan
ipkg
srcpkg
iresult
ifailure
->
srcpkg
->
Maybe
(
GenericReadyPackage
srcpkg
ipkg
)
lookupReadyPackage
plan
pkg
=
do
deps
<-
hasAllInstalledDeps
pkg
return
(
ReadyPackage
pkg
deps
)
where
hasAllInstalledDeps
::
srcpkg
->
Maybe
(
ComponentDeps
[
ipkg
])
hasAllInstalledDeps
=
T
.
mapM
(
mapM
isInstalledDep
)
.
depends
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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