<Sect1 id="sec-SystemExts">
<Title><literal>SystemExts</literal>
<IndexTerm>
  <Primary>SystemExts</Primary>
  <secondary>library</secondary>
</IndexTerm>
</Title>

<Para>
The <literal>SystemExts</literal> module contains functionality
that goes beyond what the Haskell 98 module <literal>System</literal>
provides. That is, functionality that provides access to the
underlying OS' facilities in an OS-independent manner.
</Para>

<Para>
Notice that <literal>SystemExts</literal> shares the goal of
<literal>System</literal>. 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
<literal>Posix</literal> library for
<literal>POSIX.1</literal>-conforming
platforms, the <literal>Win32</literal> library for Win32 platforms.
</Para>

<Para>
<literal>SystemExts</literal> exports the following:
</Para>

<Para>
<programlisting>
rawSystem      :: String -&#62; IO ExitCode
withArgs       :: [String] -&#62; IO a -&#62; IO a
withProgName   :: String -&#62; IO a -&#62; IO a
getEnvironment :: IO [(String, String)]
</programlisting>

<IndexTerm>
  <Primary><literal>rawSystem</literal></Primary>
  <secondary>execute system commands sans command shell</secondary>
</IndexTerm>
<IndexTerm>
  <Primary><literal>withArgs</literal></Primary>
  <secondary>change command-line arguments</secondary>
</IndexTerm>
<IndexTerm>
  <Primary><literal>withProgName</literal></Primary>
  <secondary>change program name</secondary>
</IndexTerm>
</para>

<Para>
Notes:

<ItemizedList>
<ListItem>
<Para>
<Function>rawSystem</Function> provides the exact same
behaviour as <Function>System.system</Function>, except
that the system command isn't invoked via a shell / command
interpreter. 
</Para>

<Para>
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.
</Para>
</ListItem>
<ListItem>
<Para>
The <Function>withArgs</Function> action lets you change the value
returned by <Function>System.getArgs</Function> while executing an
IO action.
</Para>
<Para>
When the action has finished executing (or if it raises an exception),
the argument vector of <Function>System.getArgs</Function> is restored.
</Para>
</ListItem>

<ListItem>
<Para>
The <Function>withProgName</Function> action lets you change the
program name string returned by <Function>System.getProgName</Function>
while executing an IO action.
</Para>
<Para>
As <Function>withArgs</Function>, when the action has finished
executing (or if it raises an exception), the program name string
<Function>System.getArgs</Function> is restored.
</Para>
</ListItem>

<ListItem>
<Para>
The <Function>getEnvironment</Function> action returns all the
environment values present in your process' environment block. 
</Para>
</ListItem>

</ItemizedList>
</Para>

</sect1>
