[Prev] [Up] [Next]


System Interaction "LibSystem"


> interface LibSystem where

The ExitCode type defines the exit codes that a program can return. ExitSuccess indicates successful termination; and ExitFailure code indicates program failure with value code. The exact interpretation of code is operating-system dependent. In particular, some values of code may be prohibited (e.g. 0 on a POSIX-compliant system).
(Rationale)

> data ExitCode =  ExitSuccess | ExitFailure Int
> getArgs       :: IO [String] 
> getProgName   :: IO String
> getEnv        :: String -> IO String
> system        :: String -> IO ExitCode
> exitWith      :: ExitCode -> IO a

Computation getArgs returns a list of the program's command line arguments (not including the program name).

Computation getProgName returns the name of the program as it was invoked.

Computation getEnv var returns the value of the environment variable var.

This computation may fail with

(Rationale)

Computation system cmd returns the exit code produced when the operating system processes the command cmd.

This computation may fail with

Computation exitWith code terminates the program, returning code to the program's caller. Before it terminates, any open or semi-closed handles are first closed.


[Prev] [Up] [Next]


The Definition of Monadic I/O in Haskell 1.3
Haskell 1.3 Committee
haskell1.3@comp.vuw.ac.nz