[commit: ghc] master: Simplify monadic code (1e26e60)

git at git.haskell.org git at git.haskell.org
Wed Mar 20 05:10:59 UTC 2019


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/1e26e60dd21c235678447ee903afbf15228e40de/ghc

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

commit 1e26e60dd21c235678447ee903afbf15228e40de
Author: Krzysztof Gogolewski <krzysztof.gogolewski at tweag.io>
Date:   Mon Mar 18 19:34:00 2019 +0100

    Simplify monadic code


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

1e26e60dd21c235678447ee903afbf15228e40de
 compiler/main/DriverPipeline.hs |  9 ++++-----
 compiler/main/GHC.hs            | 14 ++++++--------
 2 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 5866568..458a118 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1283,12 +1283,11 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags
   = do
         -- LLVM from version 3.0 onwards doesn't support the OS X system
         -- assembler, so we use clang as the assembler instead. (#5636)
-        let whichAsProg | hscTarget dflags == HscLlvm &&
-                          platformOS (targetPlatform dflags) == OSDarwin
-                        = return SysTools.runClang
-                        | otherwise = return SysTools.runAs
+        let as_prog | hscTarget dflags == HscLlvm &&
+                      platformOS (targetPlatform dflags) == OSDarwin
+                    = SysTools.runClang
+                    | otherwise = SysTools.runAs
 
-        as_prog <- whichAsProg
         let cmdline_include_paths = includePaths dflags
         let pic_c_flags = picCCOpts dflags
 
diff --git a/compiler/main/GHC.hs b/compiler/main/GHC.hs
index 4e6e0f4..9fa8911 100644
--- a/compiler/main/GHC.hs
+++ b/compiler/main/GHC.hs
@@ -683,14 +683,12 @@ checkNewInteractiveDynFlags :: MonadIO m => DynFlags -> m DynFlags
 checkNewInteractiveDynFlags dflags0 = do
   -- We currently don't support use of StaticPointers in expressions entered on
   -- the REPL. See #12356.
-  dflags1 <-
-      if xopt LangExt.StaticPointers dflags0
-      then do liftIO $ printOrThrowWarnings dflags0 $ listToBag
-                [mkPlainWarnMsg dflags0 interactiveSrcSpan
-                 $ text "StaticPointers is not supported in GHCi interactive expressions."]
-              return $ xopt_unset dflags0 LangExt.StaticPointers
-      else return dflags0
-  return dflags1
+  if xopt LangExt.StaticPointers dflags0
+  then do liftIO $ printOrThrowWarnings dflags0 $ listToBag
+            [mkPlainWarnMsg dflags0 interactiveSrcSpan
+             $ text "StaticPointers is not supported in GHCi interactive expressions."]
+          return $ xopt_unset dflags0 LangExt.StaticPointers
+  else return dflags0
 
 
 -- %************************************************************************



More information about the ghc-commits mailing list