Don't use "deriving Typeable" (for portability reasons)
[ghc-base.git] / System / Exit.hs
index 1dab14f..146fdf5 100644 (file)
 -----------------------------------------------------------------------------
 
 module System.Exit
-    ( 
+    (
       ExitCode(ExitSuccess,ExitFailure)
     , exitWith      -- :: ExitCode -> IO a
     , exitFailure   -- :: IO a
+    , exitSuccess   -- :: IO a
   ) where
 
 import Prelude
 
 #ifdef __GLASGOW_HASKELL__
+import GHC.Exception
 import GHC.IOBase
 #endif
 
@@ -59,9 +61,9 @@ 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)
 #endif
@@ -72,3 +74,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