System.Exit

haskell2010-1.1.1.0: Compatibility with Haskell 2010

Safe Haskell | Safe

System.Exit

Synopsis

- data ExitCode
  - = ExitSuccess
  - | ExitFailure Int
- exitWith :: ExitCode -> IO a
- exitFailure :: IO a
- exitSuccess :: IO a

# Documentation

data ExitCode Source

Defines the exit codes that a program can return.

Constructors

ExitSuccess | indicates successful termination;
ExitFailure Int | indicates program failure with an exit code. The exact interpretation of the code is operating-system dependent. In particular, some values may be prohibited (e.g. 0 on a POSIX-compliant system).

Instances

Eq ExitCode |
Ord ExitCode |
Read ExitCode |
Show ExitCode |
Typeable ExitCode |
Exception ExitCode |

exitWith :: ExitCode -> IO a

Computation ``exitWith` code` terminates the program, returning `code` to the program's caller. The caller may interpret the return code as it wishes, but the program should return `ExitSuccess` to mean normal completion, and ``ExitFailure` n` to mean that the program encountered a problem from which it could not recover. The value `exitFailure` is equal to ``exitWith` (`ExitFailure` exitfail)`, where `exitfail` is implementation-dependent. `exitWith` bypasses the error handling in the I/O monad and cannot be intercepted by `catch` from the `Prelude`.

exitFailure :: IO aSource

The computation `exitFailure` is equivalent to `exitWith` `(``ExitFailure` exitfail`)`, where exitfail is implementation-dependent.

exitSuccess :: IO aSource

The computation `exitSuccess` is equivalent to `exitWith` `ExitSuccess`, It terminates the program successfully.