List extensions used rather than using the -fglasgow-exts hammer
[ghc-base.git] / Setup.hs
index 40033bd..2afec6f 100644 (file)
--- a/Setup.hs
+++ b/Setup.hs
@@ -15,20 +15,16 @@ import System.Cmd
 import System.FilePath
 import System.Exit
 import System.Directory
+import Control.Exception (try)
 
 main :: IO ()
 main = do let hooks = defaultUserHooks {
                   buildHook = build_primitive_sources
-                            $ filter_modules_hook
                             $ buildHook defaultUserHooks,
                   makefileHook = build_primitive_sources
-                               $ filter_modules_hook
                                $ makefileHook defaultUserHooks,
                   haddockHook = build_primitive_sources
-                               $ filter_modules_hook
-                               $ haddockHook defaultUserHooks,
-                   instHook = filter_modules_hook
-                           $ instHook defaultUserHooks }
+                               $ haddockHook defaultUserHooks }
           defaultMainWithHooks hooks
 
 type Hook a = PackageDescription -> LocalBuildInfo -> UserHooks -> a -> IO ()
@@ -57,18 +53,7 @@ build_primitive_sources f pd lbi uhs x
 maybeUpdateFile :: FilePath -> FilePath -> IO ()
 maybeUpdateFile source target = do
   r <- rawSystem "cmp" ["-s" {-quiet-}, source, target]
-  case r of 
-    ExitSuccess   -> return ()
-    ExitFailure _ -> copyFile source target
-  removeFile source
-
-filter_modules_hook :: Hook a -> Hook a
-filter_modules_hook f pd lbi uhs x
- = let lib' = case library pd of
-                  Just lib ->
-                      let ems = filter ("GHC.Prim" /=) (exposedModules lib)
-                      in lib { exposedModules = ems }
-                  Nothing -> error "Expected a library"
-       pd' = pd { library = Just lib' }
-   in f pd' lbi uhs x
+  case r of
+    ExitSuccess   -> removeFile source
+    ExitFailure _ -> do try (removeFile target); renameFile source target