dir-traverse 0.1.0.0 → 0.2.0.0
raw patch · 3 files changed
+19/−14 lines, 3 filesdep −composition-preludedep −dlistdep −filepathdep ~basedep ~directoryPVP ok
version bump matches the API change (PVP)
Dependencies removed: composition-prelude, dlist, filepath
Dependency ranges changed: base, directory
API changes (from Hackage documentation)
- System.Directory.Recursive: getDirRecursive :: FilePath -> IO (DList FilePath)
+ System.Directory.Recursive: getDirRecursive :: FilePath -> IO [FilePath]
Files
- CHANGELOG.md +5/−0
- dir-traverse.cabal +3/−6
- src/System/Directory/Recursive.hs +11/−8
CHANGELOG.md view
@@ -1,5 +1,10 @@ # dir-traverse +## 0.2.0.0++ * Remove dependency on `dlist` and `composition-prelude`+ * Expand support through GHC 7.0.4+ ## 0.1.0.0 Initial release
dir-traverse.cabal view
@@ -1,6 +1,6 @@ cabal-version: 1.18 name: dir-traverse-version: 0.1.0.0+version: 0.2.0.0 license: BSD3 license-file: LICENSE copyright: Copyright: (c) 2019 Vanessa McHale@@ -25,11 +25,8 @@ default-language: Haskell2010 ghc-options: -Wall -O2 build-depends:- base >=4.5 && <5,- dlist -any,- directory >=1.2.5.0,- composition-prelude -any,- filepath -any+ base >=4.3 && <5,+ directory -any if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates
src/System/Directory/Recursive.hs view
@@ -1,25 +1,28 @@ module System.Directory.Recursive ( getDirRecursive ) where import Control.Applicative (pure, (<$>))-import Control.Composition ((.*)) import Control.Monad (filterM)-import qualified Data.DList as DL import Data.Foldable (fold) import Data.Traversable (traverse)-import System.Directory (doesDirectoryExist, listDirectory)-import System.FilePath ((</>))+import System.Directory (doesDirectoryExist, getDirectoryContents)+import System.Info (os) {-# INLINE getDirRecursive #-}-getDirRecursive :: FilePath -> IO (DL.DList FilePath)+getDirRecursive :: FilePath -> IO [FilePath] getDirRecursive fp = do all' <- listDirectory fp let all'' = mkRel <$> all' dirs <- filterM doesDirectoryExist all'' case dirs of- [] -> pure $ DL.fromList all''+ [] -> pure $ all'' ds -> do next <- foldMapA getDirRecursive ds- pure $ next `DL.append` DL.fromList all''+ pure $ next ++ all'' - where foldMapA = fmap fold .* traverse+ where foldMapA = (fmap fold .) . traverse mkRel = (fp </>)+ (</>) x y =+ case os of+ "mingw32" -> x ++ "\\" ++ y+ _ -> x ++ "/" ++ y+ listDirectory = fmap (filter (\p -> p /= "." && p /= "..")) . getDirectoryContents