[project @ 2002-08-28 09:24:15 by simonmar]
[ghc-hetmet.git] / ghc / compiler / main / CodeOutput.lhs
index 3953410..166c099 100644 (file)
@@ -4,7 +4,7 @@
 \section{Code output phase}
 
 \begin{code}
-module CodeOutput( codeOutput ) where
+module CodeOutput( codeOutput, outputForeignStubs ) where
 
 #include "HsVersions.h"
 
@@ -93,12 +93,7 @@ codeOutput dflags mod_name tycons core_binds stg_binds
        }
 
 doOutput :: String -> (Handle -> IO ()) -> IO ()
-doOutput filenm io_action
-  = (do        handle <- openFile filenm WriteMode
-       io_action handle
-       hClose handle)
-    `catch` (\err -> pprPanic "Failed to open or write code output file" 
-                             (text filenm))
+doOutput filenm io_action = bracket (openFile filenm WriteMode) hClose io_action
 \end{code}