+ -- hide all packages for which there is also a later version
+ -- that is already exposed. This just makes it non-fatal to have two
+ -- versions of a package exposed, which can happen if you install a
+ -- later version of a package in the user database, for example.
+ --
+ let
+ pkgs2 = map maybe_hide pkgs1
+ where maybe_hide p
+ | a_later_version_is_exposed = p {exposed=False}
+ | otherwise = p
+ where myname = pkgName (package p)
+ myversion = pkgVersion (package p)
+ a_later_version_is_exposed
+ = not (null [ p | p <- pkgs1, let pkg = package p,
+ pkgName pkg == myname,
+ pkgVersion pkg > myversion ])
+ --
+ -- Eliminate any packages which have dangling dependencies (perhaps
+ -- because the package was removed by -ignore-package).
+ --