ZVON > References > Haskell reference
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | Directory | >> System << | Time | Locale | CPUTime | Random

Module: System
Function: exitWith
Type: ExitCode -> IO a
Description: Computation exitWith code terminates the program, returning code to the program's caller. Before the program terminates, any open or semi-closed handles are first closed. 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. exitWith bypasses the error handling in the I/O monad and cannot be intercepted by catch.
Related: exitFailure

Example 1

Input: exitWith ExitSuccess

Output: <<IO action>>

Example 2
Program source: 

import System

main = aaa 1

aaa 10 = exitWith ExitSuccess
aaa x  = do putStr (show x)
	    aaa (x+1)

Output: 123456789