\begin{code}
{-# OPTIONS -Wall #-}
+import Control.Exception
import Control.Monad
-import Data.List
import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.LocalBuildInfo
main :: IO ()
main = do
- let hooks = defaultUserHooks {
+ let hooks = simpleUserHooks {
buildHook = build_primitive_sources
- $ buildHook defaultUserHooks
+ $ buildHook simpleUserHooks
}
defaultMainWithHooks hooks
\end{code}
primEnvExists <- doesFileExist primhs
genprimopcodeExists <- doesFileExist genprimopcode
primopsExists <- doesFileExist primops
- unless (primEnvExists && !genprimopcodeExists && !primopsExists) do
+ unless (primEnvExists && not genprimopcodeExists && not primopsExists) $ do
maybeExit $ system (genprimopcode ++ " --make-ext-core-source < "
++ primops ++ " > " ++ primhs_tmp)
maybeUpdateFile primhs_tmp primhs
r <- rawSystem "cmp" ["-s" {-quiet-}, source, target]
case r of
ExitSuccess -> removeFile source
- ExitFailure _ -> do try (removeFile target); renameFile source target
+ ExitFailure _ -> do (try :: IO () -> IO (Either IOException ())) (removeFile target); renameFile source target
\end{code}
\ No newline at end of file