Skip to content

Commit d20122d

Browse files
committed
Refactor configureCompiler path addition for cleaner variable names
1 parent bbd2bf7 commit d20122d

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -500,27 +500,28 @@ configureCompiler
500500
)
501501
$ do
502502
liftIO $ info verbosity "Compiler settings changed, reconfiguring..."
503-
let extraPath = fromNubList packageConfigProgramPathExtra
504-
-- Add paths in the local config
505-
progdb <- liftIO $ prependProgramSearchPath verbosity extraPath [] defaultProgramDb
506-
-- Add paths in the global config
507-
progdb' <- liftIO $ prependProgramSearchPath verbosity (fromNubList projectConfigProgPathExtra) [] progdb
508-
let progdb'' = userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths)) progdb'
509-
result@(_, _, progdb''') <-
503+
progdb <-
504+
liftIO $
505+
-- Add paths in the global config
506+
prependProgramSearchPath verbosity (fromNubList projectConfigProgPathExtra) [] defaultProgramDb
507+
-- Add paths in the local config
508+
>>= prependProgramSearchPath verbosity (fromNubList packageConfigProgramPathExtra) []
509+
>>= pure . userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths))
510+
result@(_, _, progdb') <-
510511
liftIO $
511512
Cabal.configCompilerEx
512513
hcFlavor
513514
hcPath
514515
hcPkg
515-
progdb''
516+
progdb
516517
verbosity
517518
-- Note that we added the user-supplied program locations and args
518519
-- for /all/ programs, not just those for the compiler prog and
519520
-- compiler-related utils. In principle we don't know which programs
520521
-- the compiler will configure (and it does vary between compilers).
521522
-- We do know however that the compiler will only configure the
522523
-- programs it cares about, and those are the ones we monitor here.
523-
monitorFiles (programsMonitorFiles progdb''')
524+
monitorFiles (programsMonitorFiles progdb')
524525

525526
-- Note: There is currently a bug here: we are dropping unconfigured
526527
-- programs from the 'ProgramDb' when we re-use the cache created by

0 commit comments

Comments
 (0)