X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Setup.hs;h=2ad48a435dc86fe75cc88faa656bb6fe51643ff4;hb=4fc422dc9eda25fd202d03fa3b52c9a89f0cbe47;hp=e8f73b6a59cc7779f76f28d05388f0436d1c2c91;hpb=abc9e4369fa4c24363de159bec3acb7d2baa3ec7;p=ghc-base.git diff --git a/Setup.hs b/Setup.hs index e8f73b6..2ad48a4 100644 --- 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 () @@ -59,16 +55,5 @@ maybeUpdateFile source target = do r <- rawSystem "cmp" ["-s" {-quiet-}, source, target] case r of ExitSuccess -> removeFile source - ExitFailure _ -> do removeFile target; renameFile source target - - -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 + ExitFailure _ -> do try (removeFile target); renameFile source target