FilePath -> FilePath -> IO ()
copyFile old new copies the existing file from old to new. If the new file already exists, it is atomically replaced by the old file. Neither path may refer to an existing directory. The permissions of old are copied to new, if possible.
createLink old new creates a new path, new, linked to an existing file, old.
Note: calls link.
createSymbolicLink file1 file2 creates a symbolic link named file2 which points to the file file1.
Symbolic links are interpreted at run-time as if the contents of the link had been substituted into the path being followed to find a file or directory.
Note: calls symlink.
rename old new renames a file or directory from old to new.
Note: calls rename.
renameDirectory old new 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 removeDirectory. 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, renameDirectory fails if the new directory already exists.
The operation may fail with:
* HardwareFault A physical I/O error has occurred. [EIO]
* InvalidArgument Either operand is not a valid directory name. [ENAMETOOLONG, ELOOP]
* isDoesNotExistError / NoSuchThing The original directory does not exist, or there is no path to the target. [ENOENT, ENOTDIR]
* isPermissionError / PermissionDenied The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]
* ResourceExhausted Insufficient resources are available to perform the operation. [EDQUOT, ENOSPC, ENOMEM, EMLINK]
* UnsatisfiedConstraints Implementation-dependent constraints are not satisfied. [EBUSY, ENOTEMPTY, EEXIST]
* UnsupportedOperation The implementation does not support renaming in this situation. [EINVAL, EXDEV]
* InappropriateType Either path refers to an existing non-directory object. [ENOTDIR, EISDIR]
renameFile 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 / NoSuchThing The original file does not exist, or there is no path to the target. [ENOENT, ENOTDIR]
* isPermissionError / PermissionDenied The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]
* ResourceExhausted Insufficient resources are available to perform the operation. [EDQUOT, ENOSPC, ENOMEM, EMLINK]
* UnsatisfiedConstraints Implementation-dependent constraints are not satisfied. [EBUSY]
* UnsupportedOperation The implementation does not support renaming in this situation. [EXDEV]
* InappropriateType Either path refers to an existing directory. [ENOTDIR, EISDIR, EINVAL, EEXIST, ENOTEMPTY]
The computation appendFile file str function appends the string str, to the file file.
Note that writeFile and appendFile write a literal string to a file. To write a value of any printable type, as with print, use the show function to convert the value to a string first.
> main = appendFile "squares" (show [(x,x*x) | x <- [0,0.1..2]])
The computation writeFile file str function writes the string str, to the file file.
The setEnv function inserts or resets the environment variable name in the current environment list. If the variable name does not exist in the list, it is inserted with the given value. If the variable does exist, the argument overwrite is tested; if overwrite is False, the variable is not reset, otherwise it is reset to the given value.
as throwErrno, but exceptions include the given path when appropriate.
as throwErrnoIf_, but exceptions include the given path when appropriate.
Add a response header. Example:
> setHeader "Content-type" "text/plain"
as throwErrnoIf, but exceptions include the given path when appropriate.
Show more results