[commit: ghc] ghc-8.0: Make it compile with ghc-7.8 (0a13e0c)

git at git.haskell.org git at git.haskell.org
Fri Mar 25 22:56:33 UTC 2016


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

On branch  : ghc-8.0
Link       : http://ghc.haskell.org/trac/ghc/changeset/0a13e0c60416242bf7ed5715df489901119a9944/ghc

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

commit 0a13e0c60416242bf7ed5715df489901119a9944
Author: Erik de Castro Lopo <erikd at mega-nerd.com>
Date:   Fri Mar 25 15:45:17 2016 +1100

    Make it compile with ghc-7.8
    
    * Fix `getAllocationCounter` workaround for ghc-7.8.
    * Replace `pure` with `return`.


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

0a13e0c60416242bf7ed5715df489901119a9944
 compiler/llvmGen/LlvmMangler.hs | 2 +-
 compiler/main/CodeOutput.hs     | 2 +-
 compiler/main/ErrUtils.hs       | 8 ++++++--
 compiler/main/GhcMake.hs        | 2 +-
 compiler/simplCore/SimplCore.hs | 2 +-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs
index acf344f..6fb6b7e 100644
--- a/compiler/llvmGen/LlvmMangler.hs
+++ b/compiler/llvmGen/LlvmMangler.hs
@@ -23,7 +23,7 @@ import System.IO
 -- | Read in assembly file and process
 llvmFixupAsm :: DynFlags -> FilePath -> FilePath -> IO ()
 llvmFixupAsm dflags f1 f2 = {-# SCC "llvm_mangler" #-}
-    withTiming (pure dflags) (text "LLVM Mangler") id $
+    withTiming (return dflags) (text "LLVM Mangler") id $
     withBinaryFile f1 ReadMode $ \r -> withBinaryFile f2 WriteMode $ \w -> do
         go r w
         hClose r
diff --git a/compiler/main/CodeOutput.hs b/compiler/main/CodeOutput.hs
index f172cf1..90eb2d0 100644
--- a/compiler/main/CodeOutput.hs
+++ b/compiler/main/CodeOutput.hs
@@ -64,7 +64,7 @@ codeOutput dflags this_mod filenm location foreign_stubs pkg_deps cmm_stream
                     then Stream.mapM do_lint cmm_stream
                     else cmm_stream
 
-              do_lint cmm = withTiming (pure dflags)
+              do_lint cmm = withTiming (return dflags)
                                        (text "CmmLint"<+>brackets (ppr this_mod))
                                        (const ()) $ do
                 { case cmmLint dflags cmm of
diff --git a/compiler/main/ErrUtils.hs b/compiler/main/ErrUtils.hs
index 9b98b5e..3675b85 100644
--- a/compiler/main/ErrUtils.hs
+++ b/compiler/main/ErrUtils.hs
@@ -69,7 +69,11 @@ import Data.Time
 import Control.Monad
 import Control.Monad.IO.Class
 import System.IO
+#if MIN_VERSION_base(4,8,0)
 import GHC.Conc         ( getAllocationCounter )
+#else
+import GHC.Int          ( Int64 )
+#endif
 import System.CPUTime
 
 -------------------------
@@ -507,7 +511,7 @@ withTiming getDFlags what force_result action
                   alloc0 <- liftIO getAllocationCounter
                   start <- liftIO getCPUTime
                   !r <- action
-                  () <- pure $ force_result r
+                  () <- return $ force_result r
                   end <- liftIO getCPUTime
                   alloc1 <- liftIO getAllocationCounter
                   -- recall that allocation counter counts down
@@ -520,7 +524,7 @@ withTiming getDFlags what force_result action
                        <+> text "allocated"
                        <+> doublePrec 3 (realToFrac alloc / 1024 / 1024)
                        <+> text "megabytes")
-                  pure r
+                  return r
            else action
 
 debugTraceMsg :: DynFlags -> Int -> MsgDoc -> IO ()
diff --git a/compiler/main/GhcMake.hs b/compiler/main/GhcMake.hs
index 46a4990..9dc43cd 100644
--- a/compiler/main/GhcMake.hs
+++ b/compiler/main/GhcMake.hs
@@ -114,7 +114,7 @@ depanal excluded_mods allow_dup_roots = do
          targets = hsc_targets hsc_env
          old_graph = hsc_mod_graph hsc_env
 
-  withTiming (pure dflags) (text "Chasing dependencies") (const ()) $ do
+  withTiming (return dflags) (text "Chasing dependencies") (const ()) $ do
     liftIO $ debugTraceMsg dflags 2 (hcat [
               text "Chasing modules from: ",
               hcat (punctuate comma (map pprTarget targets))])
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 98bcf2a..5fadd03 100644
--- a/compiler/simplCore/SimplCore.hs
+++ b/compiler/simplCore/SimplCore.hs
@@ -507,7 +507,7 @@ simplifyExpr :: DynFlags -- includes spec of what core-to-core passes to do
 --
 -- Also used by Template Haskell
 simplifyExpr dflags expr
-  = withTiming (pure dflags) (text "Simplify [expr]") (const ()) $
+  = withTiming (return dflags) (text "Simplify [expr]") (const ()) $
     do  {
         ; us <-  mkSplitUniqSupply 's'
 



More information about the ghc-commits mailing list