ú΃–+      !"#$%&'()*© 2016 Mark Karpov BSD 3 clause(Mark Karpov <markkarpov@openmailbox.org> experimentalportableNone35>L' Class of things (+/s) that can be canonicalized and made absolute. |Make a path absolute and remove as many indirections from it as possible. Indirections include the two special directories . and ..a, as well as any symbolic links. The input path need not point to an existing file or directory.Note,: if you require only an absolute path, use  U instead. Most programs need not care about whether a path contains symbolic links.(Due to the fact that symbolic links and ..ÿ are dependent on the state of the existing filesystem, the function can only make a conservative, best-effort attempt. Nevertheless, if the input path points to an existing file or directory, then the output path shall also point to the same file or directory.Formally, symbolic links and ..Ä are removed from the longest prefix of the path that still points to an existing file. The function is not atomic, therefore concurrent changes in the filesystem may lead to incorrect results.Š(Despite the name, the function does not guarantee canonicity of the returned path due to the presence of hard links, mount points, etc.) Similar to  normalise8, an empty path is equivalent to the current directory. Known bug(s);: on Windows, the function does not resolve symbolic links. fMake a path absolute by prepending the current directory (if it isn't already absolute) and applying  normalise to the result.|If the path is already absolute, the operation never fails. Otherwise, the operation may fail with the same exceptions as getCurrentDirectory. DClosed type-family describing how to get absolute version of given +. dir creates a new directory dirO which is initially empty, or as near to empty as the operating system allows.The operation may fail with:isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES]isAlreadyExistsError /  AlreadyExists: The operand refers to a directory that already exists.  [EEXIST] HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument. The operand is not a valid directory name. [ENAMETOOLONG, ELOOP] NoSuchThing& There is no path to the directory. [ENOENT, ENOTDIR]ResourceExhausted‰ Insufficient resources (virtual memory, process file descriptors, physical disk space, etc.) are available to perform the operation.  [EDQUOT, ENOSPC, ENOMEM, EMLINK]InappropriateType8 The path refers to an existing non-directory object. [EEXIST] parents dir creates a new directory dir0 if it doesn't exist. If the first argument is ,K the function will also create all parent directories if they are missing. dir removes an existing directory dirÿ¬. 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).The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument. The operand is not a valid directory name. [ENAMETOOLONG, ELOOP]isDoesNotExistError /  NoSuchThing! The directory does not exist. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]UnsatisfiedConstraints; Implementation-dependent constraints are not satisfied. [EBUSY, ENOTEMPTY, EEXIST]UnsupportedOperationB The implementation does not support removal in this situation. [EINVAL]InappropriateType; The operand refers to an existing non-directory object.  [ENOTDIR] dir removes an existing directory dirˆ together with its contents and subdirectories. Within this directory, symbolic links are removed without affecting their the targets. old new1 changes the name of an existing directory from old to new . If the new= directory already exists, it is atomically replaced by the old directory. If the new directory is neither the old directory nor an alias of the old$ directory, it is removed as if by Ð. 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.On Win32 platforms,  renameDir fails if the new directory already exists.The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument1 Either operand is not a valid directory name. [ENAMETOOLONG, ELOOP]isDoesNotExistError /  NoSuchThingM The original directory does not exist, or there is no path to the target. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]ResourceExhaustedB Insufficient resources are available to perform the operation.  [EDQUOT, ENOSPC, ENOMEM, EMLINK]UnsatisfiedConstraints; Implementation-dependent constraints are not satisfied. [EBUSY, ENOTEMPTY, EEXIST]UnsupportedOperationC The implementation does not support renaming in this situation. [EINVAL, EXDEV]InappropriateType; Either path refers to an existing non-directory object. [ENOTDIR, EISDIR] dir returns a list of all entries in dir without the special entries (. and ..). Entries are not sorted.The operation may fail with: HardwareFault* A physical I/O error has occurred. [EIO]InvalidArgument2 The operand is not a valid directory name. [ENAMETOOLONG, ELOOP]isDoesNotExistError /  NoSuchThing% The directory does not exist. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedI The process has insufficient privileges to perform the operation. [EACCES]ResourceExhaustedF Insufficient resources are available to perform the operation. [EMFILE, ENFILE]InappropriateType< The path refers to an existing non-directory object.  [ENOTDIR] Similar to …, but recursively traverses every sub-directory, and collects all files and directories. This can fail with the same exceptions as .ÿ3Copy directory recursively. This is not smart about symbolic links, but tries to preserve permissions when possible. If destination directory already exists, new files and sub-directories will complement its structure, possibly overwriting old files if they happen to have the same name as the new ones.- A helper for =, copies directory preserving permissions when possible. It does not copies directory contents.. A helper for 3 that replaces given path prefix with another one.9Obtain the current working directory as an absolute path.ÿ In a multithreaded program, the current working directory is a global state shared among all threads of the process. Therefore, when performing filesystem operations from multiple threads, it is highly recommended to use absolute rather than relative paths (see:  ).The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]isDoesNotExistError or  NoSuchThing8 There is no path referring to the working directory. [EPERM, ENOENT, ESTALE...]isPermissionError or PermissionDeniedE The process has insufficient privileges to perform the operation. [EACCES]ResourceExhausted@ Insufficient resources are available to perform the operation.UnsupportedOperationB The operating system has no notion of current working directory./Change the working directory to the given path.ÿ In a multithreaded program, the current working directory is a global state shared among all threads of the process. Therefore, when performing filesystem operations from multiple threads, it is highly recommended to use absolute rather than relative paths (see:  ).The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument. The operand is not a valid directory name. [ENAMETOOLONG, ELOOP]isDoesNotExistError or  NoSuchThing! The directory does not exist. [ENOENT, ENOTDIR]isPermissionError or PermissionDeniedE The process has insufficient privileges to perform the operation. [EACCES]UnsupportedOperation{ The operating system has no notion of current working directory, or the working directory cannot be dynamically changed.InappropriateType8 The path refers to an existing non-directory object.  [ENOTDIR]Run an /• action with the given working directory and restore the original working directory afterwards, even if the given action fails due to an exception.3The operation may fail with the same exceptions as  and .*Returns the current user's home directory.°The directory returned is expected to be writable by the current user, but note that it isn't generally considered good practice to store application-specific data here; use  instead. On Unix,  returns the value of the HOMEh environment variable. On Windows, the system is queried for a suitable path; a typical path might be  C:/Users/<user>.The operation may fail with:UnsupportedOperation7 The operating system has no notion of home directory.isDoesNotExistErrorN The home directory for the current user does not exist, or cannot be found.oObtain the path to a special directory for storing user-specific application data (traditional Unix location).ŠThe argument is usually the name of the application. Since it will be integrated into the path, it must consist of valid path characters."On Unix-like systems, the path is ~/.<app>.On Windows, the path is  %APPDATA%/<app> (e.g.  C:/Users/<user>/AppData/Roaming/<app>)™Note: the directory may not actually exist, in which case you would need to create it. It is expected that the parent directory exists and is writable.The operation may fail with:UnsupportedOperationQ The operating system has no notion of application-specific data directory.isDoesNotExistErrorR The home directory for the current user does not exist, or cannot be found..Returns the current user's document directory.°The directory returned is expected to be writable by the current user, but note that it isn't generally considered good practice to store application-specific data here; use  instead. On Unix,  returns the value of the HOMEh environment variable. On Windows, the system is queried for a suitable path; a typical path might be  C:/Users/<user> /Documents.The operation may fail with:UnsupportedOperation; The operating system has no notion of document directory.isDoesNotExistErrorR The document directory for the current user does not exist, or cannot be found.2Returns the current directory for temporary files. On Unix,  returns the value of the TMPDIR environment variable or "/tmp" if the variable isn't defined. On Windows, the function checks for the existence of environment variables in the following order and uses the first path found:TMP environment variable.TEMP environment variable.!USERPROFILE environment variable.The Windows directoryThe operation may fail with:UnsupportedOperation< The operating system has no notion of temporary directory.4The function doesn't verify whether the path exists. file3 removes the directory entry for an existing file file, where file¾ 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).The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument) The operand is not a valid file name. [ENAMETOOLONG, ELOOP]isDoesNotExistError /  NoSuchThing The file does not exist. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]UnsatisfiedConstraints; Implementation-dependent constraints are not satisfied. [EBUSY]InappropriateType0 The operand refers to an existing directory. [EPERM, EINVAL] old new: changes the name of an existing file system object from old to new . If the new: object already exists, it is atomically replaced by the oldå 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.The operation may fail with: HardwareFault& A physical I/O error has occurred. [EIO]InvalidArgument, Either operand is not a valid file name. [ENAMETOOLONG, ELOOP]isDoesNotExistError /  NoSuchThingH The original file does not exist, or there is no path to the target. [ENOENT, ENOTDIR]isPermissionError / PermissionDeniedE The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]ResourceExhaustedB Insufficient resources are available to perform the operation.  [EDQUOT, ENOSPC, ENOMEM, EMLINK]UnsatisfiedConstraints; Implementation-dependent constraints are not satisfied. [EBUSY]UnsupportedOperationC The implementation does not support renaming in this situation. [EXDEV]InappropriateType0 Either path refers to an existing directory. ,[ENOTDIR, EISDIR, EINVAL, EEXIST, ENOTEMPTY] old new copies the existing file from old to new . If the new7 file already exists, it is atomically replaced by the oldM file. Neither path may refer to an existing directory. The permissions of old are copied to new, if possible. YGiven an executable file name, search for such file in the directories listed in system PATH=. The returned value is the path to the found executable or 0C if an executable with the given name was not found. For example ( " "ghc") gives you the path to GHC.The path returned by  7 corresponds to the program that would be executed by D when passed the same string (as a RawCommand, not a ShellCommand). On Windows,   calls the Win32 function  SearchPathD, which may search other places before checking the directories in PATHˆ. Where it actually searches depends on registry settings, but notably includes the directory containing the current executable. See  5http://msdn.microsoft.com/en-us/library/aa365527.aspx for more details.!?Search through the given set of directories for the given file."wSearch through the given set of directories for the given file and return a list of paths where the given file exists.#¿Search through the given set of directories for the given file and with the given property (usually permissions) and return a list of paths where the given file exists and has the property.$The operation $ returns ,: if the argument file exists and is not a directory, and 1 otherwise.%The operation % returns ,_ if the argument file exists and is either a directory or a symbolic link to a directory, and 1 otherwise.&8Check if there is a file or directory on specified path.'The '> operation returns the permissions for the file or directory.The operation may fail with:isPermissionError> if the user is not permitted to access the permissions; orisDoesNotExistError) if the file or directory does not exist.(The (; operation sets the permissions for the file or directory.The operation may fail with:isPermissionError; if the user is not permitted to set the permissions; orisDoesNotExistError) if the file or directory does not exist.)uSet permissions for the object found on second given path so they match permissions of the object on the first path.*AObtain the time at which the file or directory was last modified.The operation may fail with:isPermissionErrorB if the user is not permitted to read the modification time; orisDoesNotExistError) if the file or directory does not exist.‚Caveat for POSIX systems: This function returns a timestamp with sub-second resolution only if this package is compiled against  unix-2.6.0.06 or later and the underlying filesystem supports them.2Lift action in / that takes 39 into action in slightly more abstract monad that takes +.4 Similar to 2 for functions with arity 2.5 Similar to 4%, but allows to pass second argument.6=Perform specified action ignoring IO exceptions it may throw.) Create its parents too?*The path to the directory you want to makeOld nameNew nameDirectory to listSub-directories and filesDirectory to listSub-directories and filesSource Destination-Source Destination.Original parent New parentPath to transformDirectory to execute inAction to be executed,A relative path that is appended to the pathOriginal location New locationOriginal locationWhere to put copy Executable file namePath to found executable!Set of directories to search inFilename of interest Absolute path to file (if found)"Set of directories to search inFilename of interest!Absolute paths to all found files#How to test the filesSet of directories to search inFilename of interest!Absolute paths to all found files$%&'()From where to copyWhat to modify*2Original action+ argument Lifted action4Original actionFirst + argumentSecond + argument5Original actionFirst + argumentSecond argument678+  !"#$%&'()*/  !"#$%& '()*'  -. !"#$%&'()*2456789      !"#$%&'()*+,-./012345678459:;<45=>:?@ABCDEFpathi_G5pHPeDWJbGKJis2Ai7yxGPath.IOSystem.Process createProcessdirec_KowvXytSqazBcvN7MGpFtgSystem.DirectorysetOwnerSearchablesetOwnerExecutablesetOwnerWritablesetOwnerReadableemptyPermissions searchable executablewritablereadable PermissionsAnyPathcanonicalizePath makeAbsoluteAbsPath createDircreateDirIfMissing removeDirremoveDirRecur renameDirlistDir listDirRecur copyDirRecur getCurrentDir setCurrentDirwithCurrentDir getHomeDirgetAppUserDataDirgetUserDocsDir getTempDir removeFile renameFilecopyFilefindExecutablefindFile findFiles findFilesWith doesFileExist doesDirExistisLocationOccupiedgetPermissionssetPermissionscopyPermissionsgetModificationTimepath_EXlJsIkZmQv7FLcSZOUdjs Path.InternalPathghc-prim GHC.TypesTruecopyDir swapParentIObaseGHC.BaseNothingFalseliftDGHC.IOFilePathliftD2liftD2'ignoringIOErrors $fAnyPathPath$fAnyPathPath0