[commit: packages/Cabal] ghc-head: Remove a little bit of duplication. (5b74828)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:30:07 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=5b74828d9c2b8d0a38caeb79868b8aa5232fb664

>---------------------------------------------------------------

commit 5b74828d9c2b8d0a38caeb79868b8aa5232fb664
Author: Mikhail Glushenkov <mikhail.glushenkov at gmail.com>
Date:   Mon Aug 19 11:03:04 2013 +0200

    Remove a little bit of duplication.


>---------------------------------------------------------------

5b74828d9c2b8d0a38caeb79868b8aa5232fb664
 Cabal/Distribution/Simple/Configure.hs |   25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/Cabal/Distribution/Simple/Configure.hs b/Cabal/Distribution/Simple/Configure.hs
index b71bea5..e82854e 100644
--- a/Cabal/Distribution/Simple/Configure.hs
+++ b/Cabal/Distribution/Simple/Configure.hs
@@ -296,13 +296,7 @@ configure (pkg_descr0, pbi) cfg
 
         createDirectoryIfMissingVerbose (lessVerbose verbosity) True distPref
 
-        let programsConfig =
-               userSpecifyArgss (configProgramArgs cfg)
-             . userSpecifyPaths (configProgramPaths cfg)
-             . setProgramSearchPath searchpath
-             $ configPrograms cfg
-            searchpath  = getProgramSearchPath (configPrograms cfg)
-                       ++ map ProgramSearchPathDir (configProgramPathExtra cfg)
+        let programsConfig = mkProgramsConfig cfg (configPrograms cfg)
             userInstall = fromFlag (configUserInstall cfg)
             packageDbs  = interpretPackageDbFlags userInstall
                             (configPackageDBs cfg)
@@ -593,6 +587,16 @@ configure (pkg_descr0, pbi) cfg
                       , executables = modifyExecutable  `map`
                                       executables pkg_descr}
 
+mkProgramsConfig :: ConfigFlags -> ProgramConfiguration -> ProgramConfiguration
+mkProgramsConfig cfg initialProgramsConfig = programsConfig
+  where
+    programsConfig = userSpecifyArgss (configProgramArgs cfg)
+                   . userSpecifyPaths (configProgramPaths cfg)
+                   . setProgramSearchPath searchpath
+                   $ initialProgramsConfig
+    searchpath     = getProgramSearchPath (initialProgramsConfig)
+                  ++ map ProgramSearchPathDir (configProgramPathExtra cfg)
+
 -- -----------------------------------------------------------------------------
 -- Configuring package dependencies
 
@@ -856,12 +860,7 @@ configCompilerAux cfg = configCompiler (flagToMaybe $ configHcFlavor cfg)
                                        programsConfig
                                        (fromFlag (configVerbosity cfg))
   where
-    programsConfig = userSpecifyArgss (configProgramArgs cfg)
-                   . userSpecifyPaths (configProgramPaths cfg)
-                   . setProgramSearchPath searchpath
-                   $ defaultProgramConfiguration
-    searchpath     = getProgramSearchPath (defaultProgramConfiguration)
-                  ++ map ProgramSearchPathDir (configProgramPathExtra cfg)
+    programsConfig = mkProgramsConfig cfg defaultProgramConfiguration
 
 configCompiler :: Maybe CompilerFlavor -> Maybe FilePath -> Maybe FilePath
                -> ProgramConfiguration -> Verbosity





More information about the ghc-commits mailing list