- 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, exposed p,
- let pkg = package p,
- pkgName pkg == myname,
- pkgVersion pkg > myversion ])
+ let maybe_hide p
+ | not (exposed p) = return p
+ | (p' : _) <- later_versions = do
+ debugTraceMsg dflags 2 $
+ ("hiding package " ++ showPackageId (package p) ++
+ " to avoid conflict with later version " ++
+ showPackageId (package p'))
+ return (p {exposed=False})
+ | otherwise = return p
+ where myname = pkgName (package p)
+ myversion = pkgVersion (package p)
+ later_versions = [ p | p <- pkgs1, exposed p,
+ let pkg = package p,
+ pkgName pkg == myname,
+ pkgVersion pkg > myversion ]
+ a_later_version_is_exposed
+ = not (null later_versions)
+
+ pkgs2 <- mapM maybe_hide pkgs1