10 System Functions


module System ( 
    ExitCode(ExitSuccess,ExitFailure),
    getArgs, getProgName, getEnv, system, exitWith ) where

data ExitCode = ExitSuccess | ExitFailure Int 
                deriving (Eq, Ord, Read, Show)

getArgs                 :: IO [String]
getProgName             :: IO String
getEnv                  :: String -> IO String
system                  :: String -> IO ExitCode
exitWith                :: ExitCode -> IO a

These functions interact with the system running the Haskell program. These allow the program to accept command line arguments (getArgs), read the name under which the program was invoked (getProgName), read environment variables (getEnv), exit returning status (exitWith), and execute shell or other operating system commands (system). Some operating systems may not support all of these functions.

Next section: Directory
The Haskell 1.3 Library Report