Dir
Err
NotFound - This error is raised when the specified directory does not exist, typically during attempts to access or manipulate it.
PermissionDenied - Occurs when the user lacks the necessary permissions to perform an action on a directory, such as reading, writing, or executing.
AlreadyExists - This error is thrown when trying to create a directory that already exists.
NotADirectory - Raised when an operation that requires a directory (e.g., listing contents) is attempted on a file instead.
Other - A catch-all for any other types of errors not explicitly listed above.
DirEntry
Record which represents a directory
list : Path -> Task (List Path) [DirErr Err]
Lists the files and directories inside the directory.
deleteEmpty : Path -> Task {} [DirErr Err]
Deletes a directory if it's empty
This may fail if:
- the path doesn't exist
- the path is not a directory
- the directory is not empty
- the user lacks permission to remove the directory.
deleteAll : Path -> Task {} [DirErr Err]
Recursively deletes the directory as well as all files and directories inside it.
This may fail if:
- the path doesn't exist
- the path is not a directory
- the directory is not empty
- the user lacks permission to remove the directory.
create : Path -> Task {} [DirErr Err]
Creates a directory
This may fail if:
- a parent directory does not exist
- the user lacks permission to create a directory there
- the path already exists.
createAll : Path -> Task {} [DirErr Err]
Creates a directory recursively adding any missing parent directories.
This may fail if:
- the user lacks permission to create a directory there
- the path already exists