Minor rearrangement: the implementation of System.Exit.exitWith is
GHC-specific, while exitFailure is portable.
-- program's caller. Before it terminates, any open or semi-closed
-- handles are first closed.
-#ifndef __HUGS__
+#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)
-#endif /* __HUGS__ */