par-traverse 0.1.0.0 → 0.2.0.0
raw patch · 3 files changed
+9/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- System.Directory.Parallel: parTraverse :: (FilePath -> IO ()) -> (FilePath -> IO Bool) -> [FilePath] -> IO ()
+ System.Directory.Parallel: parTraverse :: (FilePath -> IO ()) -> (FilePath -> IO Bool) -> (FilePath -> IO Bool) -> [FilePath] -> IO ()
Files
- CHANGELOG.md +4/−0
- par-traverse.cabal +1/−1
- src/System/Directory/Parallel.hs +4/−2
CHANGELOG.md view
@@ -1,5 +1,9 @@ # par-traverse +## 0.2.0.0++ * Add filter for descending into directories+ ## 0.1.0.0 Initial release
par-traverse.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: par-traverse-version: 0.1.0.0+version: 0.2.0.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2019 Vanessa McHale
src/System/Directory/Parallel.hs view
@@ -18,9 +18,10 @@ parTraverse :: (FilePath -> IO ()) -- ^ Action to execute on files -> (FilePath -> IO Bool) -- ^ Filter on files+ -> (FilePath -> IO Bool) -- ^ Filter on directories -> [FilePath] -- ^ Starting directories -> IO ()-parTraverse act fileP dirs = do+parTraverse act fileP dirP dirs = do ncpu <- getNumCapabilities withPool ncpu $ \pool -> parallel_ pool $ fmap (loopPool pool) dirs@@ -29,5 +30,6 @@ loopPool pool fp = do all' <- fmap (fp </>) <$> listDirectory fp (dirs', files) <- partitionM doesDirectoryExist all'+ dirs'' <- filterM dirP dirs' files' <- filterM fileP files- parallel_ pool (fmap act files' ++ fmap (loopPool pool) dirs')+ parallel_ pool (fmap act files' ++ fmap (loopPool pool) dirs'')