[project @ 2003-01-23 17:45:40 by ross]
[ghc-base.git] / System / Exit.hs
index 51f619f..23bfbdb 100644 (file)
@@ -25,6 +25,17 @@ import Prelude
 import GHC.IOBase
 #endif
 
+#ifdef __HUGS__
+import Hugs.Prelude
+#endif
+
+#ifdef __NHC__
+import System
+  ( ExitCode(..)
+  , exitWith
+  )
+#endif
+
 -- ---------------------------------------------------------------------------
 -- exitWith
 
@@ -32,11 +43,15 @@ import GHC.IOBase
 -- program's caller.  Before it terminates, any open or semi-closed
 -- handles are first closed.
 
+#ifndef __NHC__
 exitWith :: ExitCode -> IO a
 exitWith ExitSuccess = throw (ExitException ExitSuccess)
-exitWith code@(ExitFailure n) 
-  | n == 0 = ioException (IOError Nothing InvalidArgument "exitWith" "ExitFailure 0" Nothing)
-  | otherwise = throw (ExitException code)
+exitWith code@(ExitFailure n)
+  | n /= 0 = throw (ExitException code)
+#ifdef __GLASGOW_HASKELL__
+  | otherwise = ioError (IOError Nothing InvalidArgument "exitWith" "ExitFailure 0" Nothing)
+#endif
+#endif  /* ! __NHC__ */
 
 exitFailure :: IO a
 exitFailure = exitWith (ExitFailure 1)