X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FExit.hs;h=23bfbdb98fc38680fa1ce4e6c633782d232505da;hb=7783a84ab51ff149885a96498cefcb7f31c27513;hp=28597adcede6e7d9f8619510b9e25e42f83b2044;hpb=7f1f4e7a695c402ddd3a1dc2cc7114e649a78ebc;p=haskell-directory.git diff --git a/System/Exit.hs b/System/Exit.hs index 28597ad..23bfbdb 100644 --- a/System/Exit.hs +++ b/System/Exit.hs @@ -1,15 +1,13 @@ ----------------------------------------------------------------------------- --- +-- | -- 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.1 2001/06/28 14:15:04 simonmar Exp $ --- -- Exiting the program. -- ----------------------------------------------------------------------------- @@ -27,6 +25,17 @@ import Prelude import GHC.IOBase #endif +#ifdef __HUGS__ +import Hugs.Prelude +#endif + +#ifdef __NHC__ +import System + ( ExitCode(..) + , exitWith + ) +#endif + -- --------------------------------------------------------------------------- -- exitWith @@ -34,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)