The SystemExts module contains functionality that goes beyond what the Haskell 98 module System provides. That is, functionality that provides access to the underlying OS' facilities in an OS-independent manner.
Notice that SystemExts shares the goal of System. That is, it aims to provide functionality that's supported by all platforms. So, if you're looking to do serious system programming for a particular (family) of platforms, you really want to check out the libraries provided for the platform in question as well. e.g., The Posix library for POSIX.1-conforming platforms, the Win32 library for Win32 platforms.
SystemExts exports the following:
rawSystem :: String -> IO ExitCode withArgs :: [String] -> IO a -> IO a withProgName :: String -> IO a -> IO a getEnvironment :: IO [(String, String)] |
Notes:
rawSystem provides the exact same behaviour as System.system, except that the system command isn't invoked via a shell / command interpreter.
Not involving your platform's shell / command interpreter is quicker if you don't need its functionality, and it avoids running into limitations imposed by the shell / command interpreter. For instance, Win32 command interpreters place a limit on the length of the command they can execute (~4k), which sometimes gets in the way of what you want to do.
The withArgs action lets you change the value returned by System.getArgs while executing an IO action.
When the action has finished executing (or if it raises an exception), the argument vector of System.getArgs is restored.
The withProgName action lets you change the program name string returned by System.getProgName while executing an IO action.
As withArgs, when the action has finished executing (or if it raises an exception), the program name string System.getArgs is restored.
The getEnvironment action returns all the environment values present in your process' environment block.