Permalink
Browse files

Backport changes from CHSC to ensure that we invoke GHC 7 with the ri…

…ght flags
  • Loading branch information...
batterseapower committed Jan 17, 2011
1 parent 2dd4967 commit 5bedee72a64378725c54a58b2046af5f15d94219
Showing with 16 additions and 1 deletion.
  1. +7 −1 GHC.hs
  2. +9 −0 Utilities.hs
View
8 GHC.hs
@@ -61,6 +61,11 @@ printingModule wrapper e = unlines $
+ghcVersion :: IO [Int]
+ghcVersion = do
+ (ExitSuccess, compile_out, "") <- readProcessWithExitCode "ghc" ["--version"] ""
+ return $ map read . seperate '.' . last . words $ compile_out
+
typechecks :: String -> Term -> IO Bool
typechecks wrapper term = do
(ec, _out, err) <- withTempFile "Main.hs" $ \(file, h) -> do
@@ -93,7 +98,8 @@ runCompiled wrapper e test_e = withTempFile "Main" $ \(exe_file, exe_h) -> do
(compile_t, (ec, compile_out, compile_err)) <- withTempFile "Main.hs" $ \(hs_file, hs_h) -> do
hPutStr hs_h haskell
hClose hs_h
- time $ readProcessWithExitCode "ghc" (["--make", "-O2", hs_file, "-fforce-recomp", "-o", exe_file] ++ ["-ddump-simpl" | not qUIET]) "" --
+ ghc_ver <- ghcVersion
+ time $ readProcessWithExitCode "ghc" (["--make", "-O2", hs_file, "-fforce-recomp", "-o", exe_file] ++ ["-ddump-simpl" | not qUIET] ++ ["-rtsopts" | ghc_ver >= [7]]) "" --
compiled_size <- fileSize exe_file
case ec of
ExitFailure _ -> putStrLn haskell >> return (haskell, Left compile_err)
View
@@ -315,6 +315,15 @@ implies :: Bool -> Bool -> Bool
implies cond consq = not cond || consq
+seperate :: Eq a => a -> [a] -> [[a]]
+seperate c = go []
+ where
+ go sofar [] = [reverse sofar]
+ go sofar (x:xs)
+ | x == c = reverse sofar : go [] xs
+ | otherwise = go (x:sofar) xs
+
+
type Seconds = Double
time_ :: IO a -> IO Seconds

0 comments on commit 5bedee7

Please sign in to comment.