[commit: ghc] wip/nfs-locking: Add argWith. (cbda822)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:29:24 UTC 2017


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

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/cbda8225449ac1ed80f64843f4fc58390e113994/ghc

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

commit cbda8225449ac1ed80f64843f4fc58390e113994
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Jul 13 16:42:04 2015 +0100

    Add argWith.


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

cbda8225449ac1ed80f64843f4fc58390e113994
 src/Oracles/Builder.hs   |  7 +++----
 src/Settings/GhcCabal.hs | 20 ++++++++------------
 src/Settings/Util.hs     |  5 ++++-
 3 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/Oracles/Builder.hs b/src/Oracles/Builder.hs
index 316217f..1f3e45a 100644
--- a/src/Oracles/Builder.hs
+++ b/src/Oracles/Builder.hs
@@ -12,8 +12,7 @@ import Oracles.Base
 import Oracles.Flag
 import Oracles.Option
 
--- A Builder is an external command invoked in separate process
--- by calling Shake.cmd
+-- A Builder is an external command invoked in separate process using Shake.cmd
 --
 -- Ghc Stage0 is the bootstrapping compiler
 -- Ghc StageN, N > 0, is the one built on stage (N - 1)
@@ -82,11 +81,11 @@ needBuilder builder = do
     need [exe]
 
 -- Action 'with Gcc' returns '--with-gcc=/path/to/gcc' and needs Gcc
-with :: Builder -> Args
+with :: Builder -> Action String
 with builder = do
     exe <- showArg builder
     needBuilder builder
-    return [withBuilderKey builder ++ exe]
+    return $ withBuilderKey builder ++ exe
 
 withBuilderKey :: Builder -> String
 withBuilderKey builder = case builder of
diff --git a/src/Settings/GhcCabal.hs b/src/Settings/GhcCabal.hs
index d8eda6a..db8fd6e 100644
--- a/src/Settings/GhcCabal.hs
+++ b/src/Settings/GhcCabal.hs
@@ -25,18 +25,18 @@ cabalSettings = builder GhcCabal ? do
             , arg $ pkgPath pkg
             , arg $ targetDirectory stage pkg
             , dllSettings
-            , with' $ Ghc stage
-            , with' $ GhcPkg stage
+            , argWith $ Ghc stage
+            , argWith $ GhcPkg stage
             , stage0 ? bootPackageDbSettings
             , librarySettings
-            , configKeyNonEmpty "hscolour" ? with' HsColour -- TODO: generalise?
+            , configKeyNonEmpty "hscolour" ? argWith HsColour -- TODO: generalise?
             , configureSettings
             , stage0 ? packageConstraints
-            , with' $ Gcc stage
-            , notStage Stage0 ? with' Ld
-            , with' Ar
-            , with' Alex
-            , with' Happy ] -- TODO: reorder with's
+            , argWith $ Gcc stage
+            , notStage Stage0 ? argWith Ld
+            , argWith Ar
+            , argWith Alex
+            , argWith Happy ] -- TODO: reorder argWiths
 
 -- TODO: Isn't vanilla always built? If yes, some conditions are redundant.
 librarySettings :: Settings
@@ -90,10 +90,6 @@ bootPackageDbSettings = do
 dllSettings :: Settings
 dllSettings = arg ""
 
--- TODO: remove
-with' :: Builder -> Settings
-with' builder = appendM $ with builder
-
 packageConstraints :: Settings
 packageConstraints = do
     pkgs <- fromDiffExpr packages
diff --git a/src/Settings/Util.hs b/src/Settings/Util.hs
index 4b22be4..d7bfa49 100644
--- a/src/Settings/Util.hs
+++ b/src/Settings/Util.hs
@@ -2,7 +2,7 @@
 
 module Settings.Util (
     -- Primitive settings elements
-    arg, argM, args,
+    arg, argM, args, argWith,
     argConfig, argStagedConfig, argConfigList, argStagedConfigList,
     ccArgs,
     -- argBuilderPath, argStagedBuilderPath,
@@ -28,6 +28,9 @@ argM = appendM . fmap return
 args :: [String] -> Settings
 args = append
 
+argWith :: Builder -> Settings
+argWith = argM . with
+
 argConfig :: String -> Settings
 argConfig = appendM . fmap return . askConfig
 



More information about the ghc-commits mailing list