Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
f4727ba0
Commit
f4727ba0
authored
10 years ago
by
Mikhail Glushenkov
Browse files
Options
Downloads
Patches
Plain Diff
-Wall police, 80-col violations.
parent
46fef7d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cabal-install/Distribution/Client/PlanIndex.hs
+21
-14
21 additions, 14 deletions
cabal-install/Distribution/Client/PlanIndex.hs
with
21 additions
and
14 deletions
cabal-install/Distribution/Client/PlanIndex.hs
+
21
−
14
View file @
f4727ba0
...
...
@@ -93,9 +93,12 @@ fakeDepends fakeMap = map resolveFakeId . depends
resolveFakeId
::
InstalledPackageId
->
InstalledPackageId
resolveFakeId
ipid
=
Map
.
findWithDefault
ipid
ipid
fakeMap
--- | Variant of 'lookupInstalledPackageId' which accepts a 'FakeMap'. See Note [FakeMap].
fakeLookupInstalledPackageId
::
HasInstalledPackageId
a
=>
FakeMap
->
PackageIndex
a
->
InstalledPackageId
->
Maybe
a
fakeLookupInstalledPackageId
fakeMap
index
pkg
=
lookupInstalledPackageId
index
(
Map
.
findWithDefault
pkg
pkg
fakeMap
)
--- | Variant of 'lookupInstalledPackageId' which accepts a 'FakeMap'. See Note
--- [FakeMap].
fakeLookupInstalledPackageId
::
FakeMap
->
PackageIndex
a
->
InstalledPackageId
->
Maybe
a
fakeLookupInstalledPackageId
fakeMap
index
pkg
=
lookupInstalledPackageId
index
(
Map
.
findWithDefault
pkg
pkg
fakeMap
)
-- | All packages that have dependencies that are not in the index.
--
...
...
@@ -108,8 +111,9 @@ brokenPackages :: (HasInstalledPackageId pkg, PackageFixedDeps pkg)
brokenPackages
fakeMap
index
=
[
(
pkg
,
missing
)
|
pkg
<-
allPackages
index
,
let
missing
=
[
pkg'
|
pkg'
<-
depends
pkg
,
isNothing
(
fakeLookupInstalledPackageId
fakeMap
index
pkg'
)
]
,
let
missing
=
[
pkg'
|
pkg'
<-
depends
pkg
,
isNothing
(
fakeLookupInstalledPackageId
fakeMap
index
pkg'
)
]
,
not
(
null
missing
)
]
-- | Given a package index where we assume we want to use all the packages
...
...
@@ -122,7 +126,8 @@ brokenPackages fakeMap index =
-- depend on it and the versions they require. These are guaranteed to be
-- distinct.
--
dependencyInconsistencies
::
forall
pkg
.
(
PackageFixedDeps
pkg
,
HasInstalledPackageId
pkg
)
dependencyInconsistencies
::
forall
pkg
.
(
PackageFixedDeps
pkg
,
HasInstalledPackageId
pkg
)
=>
FakeMap
->
PackageIndex
pkg
->
[(
PackageName
,
[(
PackageIdentifier
,
Version
)])]
...
...
@@ -203,14 +208,16 @@ dependencyClosure fakeMap index pkgids0 = case closure mempty [] pkgids0 of
(
completed
,
_
)
->
Right
(
brokenPackages
fakeMap
completed
)
where
closure
completed
failed
[]
=
(
completed
,
failed
)
closure
completed
failed
(
pkgid
:
pkgids
)
=
case
fakeLookupInstalledPackageId
fakeMap
index
pkgid
of
Nothing
->
closure
completed
(
pkgid
:
failed
)
pkgids
Just
pkg
->
case
fakeLookupInstalledPackageId
fakeMap
completed
(
installedPackageId
pkg
)
of
Just
_
->
closure
completed
failed
pkgids
Nothing
->
closure
completed'
failed
pkgids'
where
completed'
=
insert
pkg
completed
pkgids'
=
depends
pkg
++
pkgids
closure
completed
failed
(
pkgid
:
pkgids
)
=
case
fakeLookupInstalledPackageId
fakeMap
index
pkgid
of
Nothing
->
closure
completed
(
pkgid
:
failed
)
pkgids
Just
pkg
->
case
fakeLookupInstalledPackageId
fakeMap
completed
(
installedPackageId
pkg
)
of
Just
_
->
closure
completed
failed
pkgids
Nothing
->
closure
completed'
failed
pkgids'
where
completed'
=
insert
pkg
completed
pkgids'
=
depends
pkg
++
pkgids
topologicalOrder
::
(
PackageFixedDeps
pkg
,
HasInstalledPackageId
pkg
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment