@@ -10,7 +10,7 @@ module Stack.Build.ConstructPlan
10
10
11
11
import Control.Monad.RWS.Strict hiding ( (<>) )
12
12
import qualified Data.List as L
13
- import qualified Data.Map.Strict as M
13
+ import qualified Data.Map.Merge. Strict as Map
14
14
import qualified Data.Map.Strict as Map
15
15
import Data.Monoid.Map ( MonoidMap (.. ) )
16
16
import qualified Data.Set as Set
@@ -93,10 +93,10 @@ combineSourceInstalled ps (location, installed) =
93
93
type CombinedMap = Map PackageName PackageInfo
94
94
95
95
combineMap :: Map PackageName PackageSource -> InstalledMap -> CombinedMap
96
- combineMap = Map. mergeWithKey
97
- (\ _ s i -> Just $ combineSourceInstalled s i )
98
- (fmap PIOnlySource )
99
- (fmap ( uncurry PIOnlyInstalled ))
96
+ combineMap = Map. merge
97
+ (Map. mapMissing ( \ _ s -> PIOnlySource s) )
98
+ (Map. mapMissing ( \ _ i -> uncurry PIOnlyInstalled i) )
99
+ (Map. zipWithMatched ( \ _ s i -> combineSourceInstalled s i ))
100
100
101
101
data AddDepRes
102
102
= ADRToInstall Task
@@ -243,29 +243,29 @@ constructPlan baseConfigOpts0 localDumpPkgs loadPackage0 sourceMap installedMap
243
243
pathEnvVar' <- liftIO $ maybe mempty T. pack <$> lookupEnv " PATH"
244
244
let ctx = mkCtx econfig globalCabalVersion sources mcur pathEnvVar'
245
245
(() , m, W efinals installExes dirtyReason warnings parents) <-
246
- liftIO $ runRWST inner ctx M . empty
246
+ liftIO $ runRWST inner ctx Map . empty
247
247
mapM_
248
248
(prettyWarn . fromString . T. unpack . textDisplay) (warnings [] )
249
249
let toEither (_, Left e) = Left e
250
250
toEither (k, Right v) = Right (k, v)
251
- (errlibs, adrs) = partitionEithers $ map toEither $ M . toList m
252
- (errfinals, finals) = partitionEithers $ map toEither $ M . toList efinals
251
+ (errlibs, adrs) = partitionEithers $ map toEither $ Map . toList m
252
+ (errfinals, finals) = partitionEithers $ map toEither $ Map . toList efinals
253
253
errs = errlibs ++ errfinals
254
254
if null errs
255
255
then do
256
256
let toTask (_, ADRFound _ _) = Nothing
257
257
toTask (name, ADRToInstall task) = Just (name, task)
258
- tasks = M . fromList $ mapMaybe toTask adrs
258
+ tasks = Map . fromList $ mapMaybe toTask adrs
259
259
takeSubset =
260
260
case boptsCLIBuildSubset $ bcoBuildOptsCLI baseConfigOpts0 of
261
261
BSAll -> pure
262
262
BSOnlySnapshot -> pure . stripLocals
263
263
BSOnlyDependencies ->
264
- pure . stripNonDeps (M . keysSet $ smDeps sourceMap)
264
+ pure . stripNonDeps (Map . keysSet $ smDeps sourceMap)
265
265
BSOnlyLocals -> errorOnSnapshot
266
266
takeSubset Plan
267
267
{ planTasks = tasks
268
- , planFinals = M . fromList finals
268
+ , planFinals = Map . fromList finals
269
269
, planUnregisterLocal =
270
270
mkUnregisterLocal tasks dirtyReason localDumpPkgs initialBuildSteps
271
271
, planInstallExes =
@@ -794,9 +794,9 @@ packageBuildTypeConfig pkg = packageBuildType pkg == Configure
794
794
-- error about cyclic dependencies, prefer the cyclic error.
795
795
updateLibMap :: PackageName -> Either ConstructPlanException AddDepRes -> M ()
796
796
updateLibMap name val = modify $ \ mp ->
797
- case (M .lookup name mp, val) of
797
+ case (Map .lookup name mp, val) of
798
798
(Just (Left DependencyCycleDetected {}), Left _) -> mp
799
- _ -> M . insert name val mp
799
+ _ -> Map . insert name val mp
800
800
801
801
addEllipsis :: Text -> Text
802
802
addEllipsis t
@@ -935,7 +935,7 @@ addPackageDeps package = do
935
935
-- Update the parents map, for later use in plan construction errors
936
936
-- - see 'getShortestDepsPath'.
937
937
addParent depname range mversion =
938
- tell mempty { wParents = MonoidMap $ M . singleton depname val }
938
+ tell mempty { wParents = MonoidMap $ Map . singleton depname val }
939
939
where
940
940
val = (First mversion, [(packageIdentifier package, range)])
941
941
@@ -1150,7 +1150,7 @@ stripNonDeps deps plan = plan
1150
1150
when (pid `elem` dependents) $
1151
1151
impureThrow $ TaskCycleBug pid
1152
1152
modify' (<> Set. singleton pid)
1153
- mapM_ (collectMissing (pid: dependents)) (fromMaybe mempty $ M .lookup pid missing)
1153
+ mapM_ (collectMissing (pid: dependents)) (fromMaybe mempty $ Map .lookup pid missing)
1154
1154
1155
1155
-- | Is the given package/version combo defined in the snapshot or in the global
1156
1156
-- database?
0 commit comments