úÎVÑRÓ=      !"#$%&'()*+,-./0123456789:;<© 2016 Mark Karpov BSD 3 clause(Mark Karpov <markkarpov@openmailbox.org> experimentalportableNone35>FL9 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. (Make a path relative to given directory.2Make a path relative to current working directory.DClosed type family describing how to get relative version of given =.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.qEnsure that directory exists creating it and its parent directories if necessary. This is just a handy shortcut: #ensureDir = createDirIfMissing True 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]? /  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]? /  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]? /  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 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]? 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]? 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 B• 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.?N 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.?R 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.?R 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.?S The temporary directory for the current user does not exist, or cannot be found.!pAppend stringly-typed path to an absolute path and then canonicalize it. This can throw the same exceptions as  . In particular, W is thrown if resulting file does not exist and thus its path cannot be canonicalized." The same as !%, but uses current working directory.# The same as !, but for directories.$ The same as #%, but uses current working directory.%% 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]? /  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]? /  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 CC 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.,0Use a temporary file that doesn't already exist.~Creates a new temporary file inside the given directory, making use of the template. The temporary file is deleted after use.-%Create and use a temporary directory.ˆCreates a new temporary directory inside the given directory, making use of the template. The temporary directory is deleted after use..LCreate and use a temporary file in the system standard temporary directory.Behaves exactly the same as ,G, except that the parent temporary directory will be that returned by  ./QCreate and use a temporary directory in the system standard temporary directory.Behaves exactly the same as -G, except that the parent temporary directory will be that returned by  .0)The function creates a temporary file in rwX mode. The created file isn't deleted automatically, so you need to delete it manually.XThe file is created with permissions such that only the current user can read/write it.ÿ;With some exceptions (see below), the file will be created securely in the sense that an attacker should not be able to cause openTempFile to overwrite another file on the filesystem using your credentials, by putting symbolic links (on Unix) in the place where the temporary file is to be created. On Unix the O_CREAT and O_EXCL7 flags are used to prevent this attack, but note that O_EXCL| is sometimes not supported on NFS filesystems, so if you rely on this behaviour it is best to use local filesystems only.1Like 0t, but opens the file in binary mode. On Windows, reading a file in text mode (which is the default) will translate CRLF to LF, and writing will translate LF to CRLFÿ. This is usually what you want with text files. With binary files this is undesirable; also, as usual under Microsoft operating systems, text mode treats control-Z as EOF. Binary mode turns off all special treatment of end-of-line and end-of-file characters.2rCreate temporary directory. The created directory isn't deleted automatically, so you need to delete it manually.]The directory is created with permissions such that only the current user can read/write it.3The operation 3 returns >: if the argument file exists and is not a directory, and D otherwise.4The operation 4 returns >_ if the argument file exists and is either a directory or a symbolic link to a directory, and D otherwise.58Check if there is a file or directory on specified path.6&If argument of the function throws a , CV is returned (other exceptions propagate). Otherwise the result is returned inside a E.7 The same as 6, but ignores result.8A synonym for 7.9The 9> 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; or?) 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; or?) 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; or?) 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.FLift action in B that takes G9 into action in slightly more abstract monad that takes =.H Similar to F for functions with arity 2.I Similar to H8, but allows to pass second argument of arbitrary type.J=Perform specified action ignoring IO exceptions it may throw.; Base directory1Path that will be made relative to base directoryCreate 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 DestinationAOriginal parent New parentPath to transformDirectory to execute inAction to be executed,A relative path that is appended to the path !Base directoryPath to resolve"Path to resolve#Base directoryPath to resolve$Path to resolve%&Original location New location'Original 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,Directory to create the file inFile name template, see 0Callback that can use the file-Directory to create the file inDirectory name template, see 0#Callback that can use the directory.File name template, see 0Callback that can use the file/Directory name template, see 0#Callback that can use the directory0Directory to create file inPFile name template; if the template is "foo.ext" then the created file will be  "fooXXX.ext" where XXX is some random numberName of created file and its K1Directory to create file inFile name template, see 0Name of created file and its K2Directory to create file inDirectory name template, see 0#Name of created temporary directory3456789:;From where to copyWhat to modify<FOriginal action= argument Lifted actionHOriginal actionFirst = argumentSecond = argumentIOriginal actionFirst = argumentSecond argumentJLM=  !"#$%&'()*+,-./0123456789:;?@ABCDEFGHIJKLMNHIOKPQHIRKPSTKUVWXYKZ[\]^pathi_BUuN0juD2Ro1VOblkoJp1hPath.IOSystem.IO.ErrordoesNotExistErrorTypeSystem.Process createProcessdirec_0hFG6ZxK1nk4zsyOqbNHfmSystem.DirectorysetOwnerSearchablesetOwnerExecutablesetOwnerWritablesetOwnerReadableemptyPermissions searchable executablewritablereadable PermissionsAnyPathcanonicalizePath makeAbsolute makeRelativemakeRelativeToCurrentDirRelPathAbsPath createDircreateDirIfMissing ensureDir removeDirremoveDirRecur renameDirlistDir listDirRecur copyDirRecur getCurrentDir setCurrentDirwithCurrentDir getHomeDirgetAppUserDataDirgetUserDocsDir getTempDir resolveFile resolveFile' resolveDir resolveDir' removeFile renameFilecopyFilefindExecutablefindFile findFiles findFilesWith withTempFile withTempDirwithSystemTempFilewithSystemTempDir openTempFileopenBinaryTempFile createTempDir doesFileExist doesDirExistisLocationOccupiedforgivingAbsenceignoringAbsenceforgivingAbsence'getPermissionssetPermissionscopyPermissionsgetModificationTimepath_BuFcQg3iwex0MNhLAdsJ0E Path.InternalPathghc-prim GHC.TypesTruebaseisDoesNotExistErrorcopyDir swapParentIOGHC.BaseNothingFalseJustliftDGHC.IOFilePathliftD2liftD2'ignoringIOErrorsGHC.IO.Handle.TypesHandle $fAnyPathPath$fAnyPathPath0