stack-0.1.10.1: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Path.IO

Description

IO actions that might be put in a package at some point.

Synopsis

Documentation

getWorkingDir :: MonadIO m => m (Path Abs Dir) Source

Get the current working directory.

parseRelAsAbsDir :: (MonadThrow m, MonadIO m) => FilePath -> m (Path Abs Dir) Source

Parse a directory path. If it's relative, then the absolute version is yielded, based off the working directory.

NOTE that this only works if the directory exists, but does not ensure that it's a directory.

parseRelAsAbsFile :: (MonadThrow m, MonadIO m) => FilePath -> m (Path Abs File) Source

Parse a file path. If it's relative, then the absolute version is yielded, based off the working directory.

NOTE that this only works if the file exists, but does not ensure that it's a file.

listDirectory :: (MonadIO m, MonadThrow m) => Path Abs Dir -> m ([Path Abs Dir], [Path Abs File]) Source

List objects in a directory, excluding "." and "..". Entries are not sorted.

resolveDir :: (MonadIO m, MonadThrow m) => Path Abs Dir -> FilePath -> m (Path Abs Dir) Source

Appends a stringly-typed relative path to an absolute path, and then canonicalizes it.

resolveFile :: (MonadIO m, MonadThrow m) => Path Abs Dir -> FilePath -> m (Path Abs File) Source

Appends a stringly-typed relative path to an absolute path, and then canonicalizes it.

resolveDirMaybe :: (MonadIO m, MonadThrow m) => Path Abs Dir -> FilePath -> m (Maybe (Path Abs Dir)) Source

Appends a stringly-typed relative path to an absolute path, and then canonicalizes it. If the path doesn't exist (and therefore cannot be canonicalized, Nothing is returned).

resolveFileMaybe :: (MonadIO m, MonadThrow m) => Path Abs Dir -> FilePath -> m (Maybe (Path Abs File)) Source

Appends a stringly-typed relative path to an absolute path, and then canonicalizes it. If the path doesn't exist (and therefore cannot be canonicalized, Nothing is returned).

removeFile :: MonadIO m => Path b File -> m () Source

Remove a file. Bails out if it doesn't exist.

removeFileIfExists :: MonadIO m => Path b File -> m () Source

Remove a file. Optimistically assumes it exists. If it doesn't, doesn't complain.

removeTree :: MonadIO m => Path b Dir -> m () Source

Remove a tree. Bails out if it doesn't exist.

removeTreeIfExists :: MonadIO m => Path b Dir -> m () Source

Remove tree, don't complain about non-existent directories.

renameFile :: MonadIO m => Path b1 File -> Path b2 File -> m () Source

Rename a file. Bails out if it doesn't exist.

renameFileIfExists :: MonadIO m => Path b1 File -> Path b2 File -> m () Source

Rename a file. Optimistically assumes it exists. If it doesn't, doesn't complain.

renameDir :: MonadIO m => Path b1 Dir -> Path b2 Dir -> m () Source

renameDirIfExists :: MonadIO m => Path b1 Dir -> Path b2 Dir -> m () Source

Rename a directory. Optimistically assumes it exists. If it doesn't, doesn't complain.

moveFile :: MonadIO m => Path b1 File -> Path b2 Dir -> m () Source

Move a file. Bails out if it doesn't exist.

moveFileIfExists :: MonadIO m => Path b1 File -> Path b2 Dir -> m () Source

Move a file. Optimistically assumes it exists. If it doesn't, doesn't complain.

moveDir :: MonadIO m => Path b1 Dir -> Path b2 Dir -> m () Source

Move a dir. Bails out if it doesn't exist.

moveDirIfExists :: MonadIO m => Path b1 Dir -> Path b2 Dir -> m () Source

Move a dir. Optimistically assumes it exists. If it doesn't, doesn't complain.

fileExists :: MonadIO m => Path b File -> m Bool Source

Does the file exist?

dirExists :: MonadIO m => Path b Dir -> m Bool Source

Does the directory exist?

copyFile :: MonadIO m => Path b1 File -> Path b2 File -> m () Source

Copies a file to another path. Bails out if it doesn't exist.

copyFileIfExists :: MonadIO m => Path b1 File -> Path b2 File -> m () Source

Copies a file to another path. Optimistically assumes it exists. If it doesn't, doesn't complain.

copyDirectoryRecursive Source

Arguments

:: (MonadIO m, MonadThrow m) 
=> Path Abs Dir

Source directory

-> Path Abs Dir

Destination directory

-> m () 

Copy a directory recursively. This just uses copyFile, so it is not smart about symbolic links or other special files.

createTree :: MonadIO m => Path b Dir -> m () Source

Make a directory tree, creating parents if needed.

withCanonicalizedSystemTempDirectory Source

Arguments

:: (MonadMask m, MonadIO m) 
=> String

Directory name template.

-> (Path Abs Dir -> m a)

Callback that can use the canonicalized directory

-> m a 

withCanonicalizedTempDirectory Source

Arguments

:: (MonadMask m, MonadIO m) 
=> FilePath

Temp directory to create the directory in

-> String

Directory name template.

-> (Path Abs Dir -> m a)

Callback that can use the canonicalized directory

-> m a