-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Path walking utilities for Haskell programs -- -- System.Directory.PathWalk is an implementation of Python's -- excellent os.walk function. Given a root directory, it recursively -- scans all subdirectories, calling a callback with directories and -- files it finds. Importantly, it calls the callback as soon as it -- finishes scanning each directory to allow the caller to begin -- processing results immediately. -- -- Maximum memory usage is O(N+M) where N is the depth of the tree and M -- is the maximum number of entries in a particular directory. -- --
-- import System.Directory.PathWalk
--
-- pathWalk "some/directory" $ \root dirs files -> do
-- forM_ files $ \file ->
-- when (".hs" `isSuffixOf` file) $ do
-- putStrLn $ joinPath [root, file]
--
@package pathwalk
@version 0.2.0.0
module System.Directory.PathWalk
-- | pathWalk recursively enumerates the given root directory,
-- calling callback once per directory with the traversed directory name,
-- a list of subdirectories, and a list of files.
--
-- The subdirectories and file names are always relative to the root
-- given.
--
--
-- pathWalk "src" $ \dir subdirs files -> do
-- forM_ files $ \file -> do
-- when ("Test.hs" `isSuffixOf` file) $ do
-- registerTestFile $ dir </> file
--
pathWalk :: FilePath -> (FilePath -> [FilePath] -> [FilePath] -> IO ()) -> IO ()