Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A collection of file system utilities that appear to be missing from Directory, FilePath, Prelude, etc. Some of these may overlap with MissingH but the versions here will probably be more simplistic. Furthermore, this library is focused on this one thing and not a whole bunch of things.
Synopsis
- mtreeList :: Monad m => (a -> m [a]) -> a -> m [a]
- fileList :: FilePath -> IO [FilePath]
- walkDir :: FilePath -> IO [Directory]
- copyDir :: FilePath -> FilePath -> IO ()
- replaceRoot :: FilePath -> FilePath -> FilePath -> FilePath
- removeRoot :: FilePath -> FilePath -> FilePath
- data Directory
- $sel:dirPath:Directory :: Directory -> FilePath
- $sel:subDirs:Directory :: Directory -> [FilePath]
- $sel:files:Directory :: Directory -> [FilePath]
- createDir :: FilePath -> IO Directory
- filterUseless :: [FilePath] -> [FilePath]
Documentation
mtreeList :: Monad m => (a -> m [a]) -> a -> m [a] Source #
Returns a list of nodes in a tree via a depth-first walk.
fileList :: FilePath -> IO [FilePath] Source #
Recursively list the contents of a directory. Depth-first.
walkDir :: FilePath -> IO [Directory] Source #
Walk a directory depth-first. Similar to Python's os.walk and fs.core/walk from the fs Clojure library.
copyDir :: FilePath -> FilePath -> IO () Source #
Copy a directory recursively. Moves every file, creates every directory.
replaceRoot :: FilePath -> FilePath -> FilePath -> FilePath Source #
Given a root path, a new root path, and a path to be changed, removes the old root from the path and replaces it with to.
removeRoot :: FilePath -> FilePath -> FilePath Source #
Given a root (prefix), remove it from a path. This is useful for getting the filename and subdirs of a path inside of a root.
We can use this data type to represent the pieces of a directory.
$sel:dirPath:Directory :: Directory -> FilePath Source #
The path of the directory itself.
$sel:subDirs:Directory :: Directory -> [FilePath] Source #
All subdirectories of this directory.
$sel:files:Directory :: Directory -> [FilePath] Source #
All files contained in this directory.
filterUseless :: [FilePath] -> [FilePath] Source #
Remove useless paths from a list of paths.