Fix build when we have HTYPE_TCFLAG_T
[ghc-base.git] / System / Exit.hs
index 1dab14f..f4fbac5 100644 (file)
 -----------------------------------------------------------------------------
 
 module System.Exit
-    ( 
+    (
       ExitCode(ExitSuccess,ExitFailure)
     , exitWith      -- :: ExitCode -> IO a
     , exitFailure   -- :: IO a
+    , exitSuccess   -- :: IO a
   ) where
 
 import Prelude
@@ -26,8 +27,8 @@ import GHC.IOBase
 #endif
 
 #ifdef __HUGS__
-import Hugs.Prelude
-import Hugs.Exception
+import Hugs.Prelude (ExitCode(..))
+import Control.Exception.Base
 #endif
 
 #ifdef __NHC__
@@ -59,11 +60,11 @@ import System
 
 #ifndef __NHC__
 exitWith :: ExitCode -> IO a
-exitWith ExitSuccess = throwIO (ExitException ExitSuccess)
+exitWith ExitSuccess = throwIO ExitSuccess
 exitWith code@(ExitFailure n)
-  | n /= 0 = throwIO (ExitException code)
+  | n /= 0 = throwIO code
 #ifdef __GLASGOW_HASKELL__
-  | otherwise = ioError (IOError Nothing InvalidArgument "exitWith" "ExitFailure 0" Nothing)
+  | otherwise = ioError (IOError Nothing InvalidArgument "exitWith" "ExitFailure 0" Nothing Nothing)
 #endif
 #endif  /* ! __NHC__ */
 
@@ -72,3 +73,9 @@ exitWith code@(ExitFailure n)
 -- where /exitfail/ is implementation-dependent.
 exitFailure :: IO a
 exitFailure = exitWith (ExitFailure 1)
+
+-- | The computation 'exitSuccess' is equivalent to
+-- 'exitWith' 'ExitSuccess', It terminates the program
+-- sucessfully.
+exitSuccess :: IO a
+exitSuccess = exitWith ExitSuccess