<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Directory</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Directory.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">haskell98-2.0.0.1: Compatibility with Haskell 98</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>Trustworthy</td></tr></table><p class="caption">Directory</p></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><span class="keyword">data</span> <a href="#t:Permissions">Permissions</a> = <a href="#v:Permissions">Permissions</a> {<ul class="subs"><li><a href="#v:readable">readable</a> :: <a href="Prelude.html#t:Bool">Bool</a></li><li><a href="#v:writable">writable</a> :: <a href="Prelude.html#t:Bool">Bool</a></li><li><a href="#v:executable">executable</a> :: <a href="Prelude.html#t:Bool">Bool</a></li><li><a href="#v:searchable">searchable</a> :: <a href="Prelude.html#t:Bool">Bool</a></li></ul>}</li><li class="src short"><a href="#v:createDirectory">createDirectory</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:removeDirectory">removeDirectory</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:removeFile">removeFile</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:renameDirectory">renameDirectory</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:renameFile">renameFile</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:getDirectoryContents">getDirectoryContents</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> [<a href="Prelude.html#t:FilePath">FilePath</a>]</li><li class="src short"><a href="#v:getCurrentDirectory">getCurrentDirectory</a> :: <a href="Prelude.html#t:IO">IO</a> <a href="Prelude.html#t:FilePath">FilePath</a></li><li class="src short"><a href="#v:setCurrentDirectory">setCurrentDirectory</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:doesFileExist">doesFileExist</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> <a href="Prelude.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:doesDirectoryExist">doesDirectoryExist</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> <a href="Prelude.html#t:Bool">Bool</a></li><li class="src short"><a href="#v:getPermissions">getPermissions</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> <a href="Directory.html#t:Permissions">Permissions</a></li><li class="src short"><a href="#v:setPermissions">setPermissions</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Directory.html#t:Permissions">Permissions</a> -> <a href="Prelude.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:getModificationTime">getModificationTime</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> <a href="Time.html#t:ClockTime">ClockTime</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:Permissions" class="def">Permissions</a> </p><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:Permissions" class="def">Permissions</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:readable" class="def">readable</a> :: <a href="Prelude.html#t:Bool">Bool</a></dt><dd class="doc empty"> </dd><dt class="src"><a name="v:writable" class="def">writable</a> :: <a href="Prelude.html#t:Bool">Bool</a></dt><dd class="doc empty"> </dd><dt class="src"><a name="v:executable" class="def">executable</a> :: <a href="Prelude.html#t:Bool">Bool</a></dt><dd class="doc empty"> </dd><dt class="src"><a name="v:searchable" class="def">searchable</a> :: <a href="Prelude.html#t:Bool">Bool</a></dt><dd class="doc empty"> </dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:Permissions" class="caption collapser" onclick="toggleSection('i:Permissions')">Instances</p><div id="section.i:Permissions" class="show"><table><tr><td class="src"><a href="Prelude.html#t:Eq">Eq</a> <a href="Directory.html#t:Permissions">Permissions</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Prelude.html#t:Ord">Ord</a> <a href="Directory.html#t:Permissions">Permissions</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Prelude.html#t:Read">Read</a> <a href="Directory.html#t:Permissions">Permissions</a></td><td class="doc empty"> </td></tr><tr><td class="src"><a href="Prelude.html#t:Show">Show</a> <a href="Directory.html#t:Permissions">Permissions</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:createDirectory" class="def">createDirectory</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../directory-1.1.0.2/src/System-Directory.html#createDirectory" class="link">Source</a></p><div class="doc"><p><code><code><a href="Directory.html#v:createDirectory">createDirectory</a></code> dir</code> creates a new directory <code>dir</code> which is initially empty, or as near to empty as the operating system allows. </p><p>The operation may fail with: </p><ul><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code> The process has insufficient privileges to perform the operation. <code>[EROFS, EACCES]</code> </li><li> <code><a href="IO.html#v:isAlreadyExistsError">isAlreadyExistsError</a></code> / <code>AlreadyExists</code> The operand refers to a directory that already exists. <code> [EEXIST]</code> </li><li> <code>HardwareFault</code> A physical I/O error has occurred. <code>[EIO]</code> </li><li> <code>InvalidArgument</code> The operand is not a valid directory name. <code>[ENAMETOOLONG, ELOOP]</code> </li><li> <code>NoSuchThing</code> There is no path to the directory. <code>[ENOENT, ENOTDIR]</code> </li><li> <code>ResourceExhausted</code> Insufficient resources (virtual memory, process file descriptors, physical disk space, etc.) are available to perform the operation. <code>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</code> </li><li> <code>InappropriateType</code> The path refers to an existing non-directory object. <code>[EEXIST]</code> </li></ul></div></div><div class="top"><p class="src"><a name="v:removeDirectory" class="def">removeDirectory</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../directory-1.1.0.2/src/System-Directory.html#removeDirectory" class="link">Source</a></p><div class="doc"><p><code><code><a href="Directory.html#v:removeDirectory">removeDirectory</a></code> dir</code> removes an existing directory <em>dir</em>. The implementation may specify additional constraints which must be satisfied before a directory can be removed (e.g. the directory has to be empty, or may not be in use by other processes). It is not legal for an implementation to partially remove a directory unless the entire directory is removed. A conformant implementation need not support directory removal in all situations (e.g. removal of the root directory). </p><p>The operation may fail with: </p><ul><li> <code>HardwareFault</code> A physical I/O error has occurred. EIO </li><li> <code>InvalidArgument</code> The operand is not a valid directory name. [ENAMETOOLONG, ELOOP] </li><li> <code><a href="IO.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code> The directory does not exist. <code>[ENOENT, ENOTDIR]</code> </li><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code> The process has insufficient privileges to perform the operation. <code>[EROFS, EACCES, EPERM]</code> </li><li> <code>UnsatisfiedConstraints</code> Implementation-dependent constraints are not satisfied. <code>[EBUSY, ENOTEMPTY, EEXIST]</code> </li><li> <code>UnsupportedOperation</code> The implementation does not support removal in this situation. <code>[EINVAL]</code> </li><li> <code>InappropriateType</code> The operand refers to an existing non-directory object. <code>[ENOTDIR]</code> </li></ul></div></div><div class="top"><p class="src"><a name="v:removeFile" class="def">removeFile</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../directory-1.1.0.2/src/System-Directory.html#removeFile" class="link">Source</a></p><div class="doc"><p><code><a href="Directory.html#v:removeFile">removeFile</a></code> <em>file</em> removes the directory entry for an existing file <em>file</em>, where <em>file</em> is not itself a directory. The implementation may specify additional constraints which must be satisfied before a file can be removed (e.g. the file may not be in use by other processes). </p><p>The operation may fail with: </p><ul><li> <code>HardwareFault</code> A physical I/O error has occurred. <code>[EIO]</code> </li><li> <code>InvalidArgument</code> The operand is not a valid file name. <code>[ENAMETOOLONG, ELOOP]</code> </li><li> <code><a href="IO.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code> The file does not exist. <code>[ENOENT, ENOTDIR]</code> </li><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code> The process has insufficient privileges to perform the operation. <code>[EROFS, EACCES, EPERM]</code> </li><li> <code>UnsatisfiedConstraints</code> Implementation-dependent constraints are not satisfied. <code>[EBUSY]</code> </li><li> <code>InappropriateType</code> The operand refers to an existing directory. <code>[EPERM, EINVAL]</code> </li></ul></div></div><div class="top"><p class="src"><a name="v:renameDirectory" class="def">renameDirectory</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../directory-1.1.0.2/src/System-Directory.html#renameDirectory" class="link">Source</a></p><div class="doc"><p><code><code><a href="Directory.html#v:renameDirectory">renameDirectory</a></code> old new</code> changes the name of an existing directory from <em>old</em> to <em>new</em>. If the <em>new</em> directory already exists, it is atomically replaced by the <em>old</em> directory. If the <em>new</em> directory is neither the <em>old</em> directory nor an alias of the <em>old</em> directory, it is removed as if by <code><a href="Directory.html#v:removeDirectory">removeDirectory</a></code>. A conformant implementation need not support renaming directories in all situations (e.g. renaming to an existing directory, or across different physical devices), but the constraints must be documented. </p><p>On Win32 platforms, <code>renameDirectory</code> fails if the <em>new</em> directory already exists. </p><p>The operation may fail with: </p><ul><li> <code>HardwareFault</code> A physical I/O error has occurred. <code>[EIO]</code> </li><li> <code>InvalidArgument</code> Either operand is not a valid directory name. <code>[ENAMETOOLONG, ELOOP]</code> </li><li> <code><a href="IO.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code> The original directory does not exist, or there is no path to the target. <code>[ENOENT, ENOTDIR]</code> </li><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code> The process has insufficient privileges to perform the operation. <code>[EROFS, EACCES, EPERM]</code> </li><li> <code>ResourceExhausted</code> Insufficient resources are available to perform the operation. <code>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</code> </li><li> <code>UnsatisfiedConstraints</code> Implementation-dependent constraints are not satisfied. <code>[EBUSY, ENOTEMPTY, EEXIST]</code> </li><li> <code>UnsupportedOperation</code> The implementation does not support renaming in this situation. <code>[EINVAL, EXDEV]</code> </li><li> <code>InappropriateType</code> Either path refers to an existing non-directory object. <code>[ENOTDIR, EISDIR]</code> </li></ul></div></div><div class="top"><p class="src"><a name="v:renameFile" class="def">renameFile</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../directory-1.1.0.2/src/System-Directory.html#renameFile" class="link">Source</a></p><div class="doc"><p><code><code><a href="Directory.html#v:renameFile">renameFile</a></code> old new</code> changes the name of an existing file system object from <em>old</em> to <em>new</em>. If the <em>new</em> object already exists, it is atomically replaced by the <em>old</em> object. Neither path may refer to an existing directory. A conformant implementation need not support renaming files in all situations (e.g. renaming across different physical devices), but the constraints must be documented. </p><p>The operation may fail with: </p><ul><li> <code>HardwareFault</code> A physical I/O error has occurred. <code>[EIO]</code> </li><li> <code>InvalidArgument</code> Either operand is not a valid file name. <code>[ENAMETOOLONG, ELOOP]</code> </li><li> <code><a href="IO.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code> The original file does not exist, or there is no path to the target. <code>[ENOENT, ENOTDIR]</code> </li><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code> The process has insufficient privileges to perform the operation. <code>[EROFS, EACCES, EPERM]</code> </li><li> <code>ResourceExhausted</code> Insufficient resources are available to perform the operation. <code>[EDQUOT, ENOSPC, ENOMEM, EMLINK]</code> </li><li> <code>UnsatisfiedConstraints</code> Implementation-dependent constraints are not satisfied. <code>[EBUSY]</code> </li><li> <code>UnsupportedOperation</code> The implementation does not support renaming in this situation. <code>[EXDEV]</code> </li><li> <code>InappropriateType</code> Either path refers to an existing directory. <code>[ENOTDIR, EISDIR, EINVAL, EEXIST, ENOTEMPTY]</code> </li></ul></div></div><div class="top"><p class="src"><a name="v:getDirectoryContents" class="def">getDirectoryContents</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> [<a href="Prelude.html#t:FilePath">FilePath</a>]<a href="../directory-1.1.0.2/src/System-Directory.html#getDirectoryContents" class="link">Source</a></p><div class="doc"><p><code><code><a href="Directory.html#v:getDirectoryContents">getDirectoryContents</a></code> dir</code> returns a list of <em>all</em> entries in <em>dir</em>. </p><p>The operation may fail with: </p><ul><li> <code>HardwareFault</code> A physical I/O error has occurred. <code>[EIO]</code> </li><li> <code>InvalidArgument</code> The operand is not a valid directory name. <code>[ENAMETOOLONG, ELOOP]</code> </li><li> <code><a href="IO.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code> The directory does not exist. <code>[ENOENT, ENOTDIR]</code> </li><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code> The process has insufficient privileges to perform the operation. <code>[EACCES]</code> </li><li> <code>ResourceExhausted</code> Insufficient resources are available to perform the operation. <code>[EMFILE, ENFILE]</code> </li><li> <code>InappropriateType</code> The path refers to an existing non-directory object. <code>[ENOTDIR]</code> </li></ul></div></div><div class="top"><p class="src"><a name="v:getCurrentDirectory" class="def">getCurrentDirectory</a> :: <a href="Prelude.html#t:IO">IO</a> <a href="Prelude.html#t:FilePath">FilePath</a><a href="../directory-1.1.0.2/src/System-Directory.html#getCurrentDirectory" class="link">Source</a></p><div class="doc"><p>If the operating system has a notion of current directories, <code><a href="Directory.html#v:getCurrentDirectory">getCurrentDirectory</a></code> returns an absolute path to the current directory of the calling process. </p><p>The operation may fail with: </p><ul><li> <code>HardwareFault</code> A physical I/O error has occurred. <code>[EIO]</code> </li><li> <code><a href="IO.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code> There is no path referring to the current directory. <code>[EPERM, ENOENT, ESTALE...]</code> </li><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code> The process has insufficient privileges to perform the operation. <code>[EACCES]</code> </li><li> <code>ResourceExhausted</code> Insufficient resources are available to perform the operation. </li><li> <code>UnsupportedOperation</code> The operating system has no notion of current directory. </li></ul><p>Note that in a concurrent program, the current directory is global state shared between all threads of the process. When using filesystem operations from multiple threads, it is therefore highly recommended to use absolute rather than relative <code><a href="Prelude.html#t:FilePath">FilePath</a></code>s. </p></div></div><div class="top"><p class="src"><a name="v:setCurrentDirectory" class="def">setCurrentDirectory</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> ()<a href="../directory-1.1.0.2/src/System-Directory.html#setCurrentDirectory" class="link">Source</a></p><div class="doc"><p>If the operating system has a notion of current directories, <code><code><a href="Directory.html#v:setCurrentDirectory">setCurrentDirectory</a></code> dir</code> changes the current directory of the calling process to <em>dir</em>. </p><p>The operation may fail with: </p><ul><li> <code>HardwareFault</code> A physical I/O error has occurred. <code>[EIO]</code> </li><li> <code>InvalidArgument</code> The operand is not a valid directory name. <code>[ENAMETOOLONG, ELOOP]</code> </li><li> <code><a href="IO.html#v:isDoesNotExistError">isDoesNotExistError</a></code> / <code>NoSuchThing</code> The directory does not exist. <code>[ENOENT, ENOTDIR]</code> </li><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> / <code>PermissionDenied</code> The process has insufficient privileges to perform the operation. <code>[EACCES]</code> </li><li> <code>UnsupportedOperation</code> The operating system has no notion of current directory, or the current directory cannot be dynamically changed. </li><li> <code>InappropriateType</code> The path refers to an existing non-directory object. <code>[ENOTDIR]</code> </li></ul><p>Note that in a concurrent program, the current directory is global state shared between all threads of the process. When using filesystem operations from multiple threads, it is therefore highly recommended to use absolute rather than relative <code><a href="Prelude.html#t:FilePath">FilePath</a></code>s. </p></div></div><div class="top"><p class="src"><a name="v:doesFileExist" class="def">doesFileExist</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> <a href="Prelude.html#t:Bool">Bool</a><a href="../directory-1.1.0.2/src/System-Directory.html#doesFileExist" class="link">Source</a></p><div class="doc"><p>The operation <code><a href="Directory.html#v:doesFileExist">doesFileExist</a></code> returns <code><a href="Prelude.html#v:True">True</a></code> if the argument file exists and is not a directory, and <code><a href="Prelude.html#v:False">False</a></code> otherwise. </p></div></div><div class="top"><p class="src"><a name="v:doesDirectoryExist" class="def">doesDirectoryExist</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> <a href="Prelude.html#t:Bool">Bool</a><a href="../directory-1.1.0.2/src/System-Directory.html#doesDirectoryExist" class="link">Source</a></p><div class="doc"><p>The operation <code><a href="Directory.html#v:doesDirectoryExist">doesDirectoryExist</a></code> returns <code><a href="Prelude.html#v:True">True</a></code> if the argument file exists and is a directory, and <code><a href="Prelude.html#v:False">False</a></code> otherwise. </p></div></div><div class="top"><p class="src"><a name="v:getPermissions" class="def">getPermissions</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> <a href="Directory.html#t:Permissions">Permissions</a></p></div><div class="top"><p class="src"><a name="v:setPermissions" class="def">setPermissions</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Directory.html#t:Permissions">Permissions</a> -> <a href="Prelude.html#t:IO">IO</a> ()</p></div><div class="top"><p class="src"><a name="v:getModificationTime" class="def">getModificationTime</a> :: <a href="Prelude.html#t:FilePath">FilePath</a> -> <a href="Prelude.html#t:IO">IO</a> <a href="Time.html#t:ClockTime">ClockTime</a><a href="../directory-1.1.0.2/src/System-Directory.html#getModificationTime" class="link">Source</a></p><div class="doc"><p>The <code><a href="Directory.html#v:getModificationTime">getModificationTime</a></code> operation returns the clock time at which the file or directory was last modified. </p><p>The operation may fail with: </p><ul><li> <code><a href="IO.html#v:isPermissionError">isPermissionError</a></code> if the user is not permitted to access the modification time; or </li><li> <code><a href="IO.html#v:isDoesNotExistError">isDoesNotExistError</a></code> if the file or directory does not exist. </li></ul></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>