@@ -553,14 +553,14 @@ getCachedDepOrAddDep name = do
553
553
pure res
554
554
Nothing -> checkCallStackAndAddDep name
555
555
556
- -- | Given a 'PackageName', adds all of the build tasks to build the package.
557
- -- First checks that the package name is not already in the call stack.
556
+ -- | Given a 'PackageName', known not to be in the library map, adds all of the
557
+ -- build tasks to build the package. First checks that the package name is not
558
+ -- already in the call stack.
558
559
checkCallStackAndAddDep ::
559
560
PackageName
560
561
-> M (Either ConstructPlanException AddDepRes )
561
562
checkCallStackAndAddDep name = do
562
563
ctx <- ask
563
- let mpackageInfo = Map. lookup name $ combinedMap ctx
564
564
res <- if name `elem` callStack ctx
565
565
then do
566
566
logDebugPlanS " checkCallStackAndAddDep" $
@@ -569,17 +569,19 @@ checkCallStackAndAddDep name = do
569
569
<> " : "
570
570
<> fromString (show $ map packageNameString (callStack ctx))
571
571
pure $ Left $ DependencyCycleDetected $ name : callStack ctx
572
- else local (\ ctx' -> ctx' { callStack = name : callStack ctx' }) $ do
573
- case mpackageInfo of
574
- -- TODO look up in the package index and see if there's a
575
- -- recommendation available
576
- Nothing -> do
577
- logDebugPlanS " checkCallStackAndAddDep" $
578
- " No package info for "
579
- <> fromString (packageNameString name)
580
- <> " ."
581
- pure $ Left $ UnknownPackage name
582
- Just packageInfo -> addDep name packageInfo
572
+ else case Map. lookup name $ combinedMap ctx of
573
+ -- TODO look up in the package index and see if there's a
574
+ -- recommendation available
575
+ Nothing -> do
576
+ logDebugPlanS " checkCallStackAndAddDep" $
577
+ " No package info for "
578
+ <> fromString (packageNameString name)
579
+ <> " ."
580
+ pure $ Left $ UnknownPackage name
581
+ Just packageInfo ->
582
+ -- Add the current package name to the head of the call stack.
583
+ local (\ ctx' -> ctx' { callStack = name : callStack ctx' }) $
584
+ addDep name packageInfo
583
585
updateLibMap name res
584
586
pure res
585
587
0 commit comments