[project @ 2002-10-11 11:05:20 by malcolm]
[ghc-base.git] / System / Exit.hs
index 6d486c9..3c0ecb8 100644 (file)
@@ -2,14 +2,12 @@
 -- |
 -- Module      :  System.Exit
 -- Copyright   :  (c) The University of Glasgow 2001
--- License     :  BSD-style (see the file libraries/core/LICENSE)
+-- License     :  BSD-style (see the file libraries/base/LICENSE)
 -- 
 -- Maintainer  :  libraries@haskell.org
 -- Stability   :  provisional
 -- Portability :  portable
 --
--- $Id: Exit.hs,v 1.2 2002/04/24 16:31:45 simonmar Exp $
---
 -- Exiting the program.
 --
 -----------------------------------------------------------------------------
@@ -27,6 +25,17 @@ import Prelude
 import GHC.IOBase
 #endif
 
+#ifdef __HUGS__
+import Hugs.System
+#endif
+
+#ifdef __NHC__
+import System
+  ( ExitCode(..)
+  , exitWith
+  )
+#endif
+
 -- ---------------------------------------------------------------------------
 -- exitWith
 
@@ -34,11 +43,13 @@ import GHC.IOBase
 -- program's caller.  Before it terminates, any open or semi-closed
 -- handles are first closed.
 
+#ifdef __GLASGOW_HASKELL__
 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)
+#endif  /* __GLASGOW_HASKELL__ */
 
 exitFailure :: IO a
 exitFailure = exitWith (ExitFailure 1)