posix-paths 0.1.1.0 → 0.1.1.1
raw patch · 3 files changed
+29/−5 lines, 3 filesdep +HUnitPVP ok
version bump matches the API change (PVP)
Dependencies added: HUnit
API changes (from Hackage documentation)
Files
- doctests.hs +20/−1
- posix-paths.cabal +4/−3
- src/System/Posix/Directory/Traversals.hs +5/−1
doctests.hs view
@@ -1,5 +1,24 @@+{-# LANGUAGE OverloadedStrings #-}+ module Main where +import Control.Applicative+import System.Posix.Directory.Traversals+ import Test.DocTest+import Test.HUnit -main = doctest ["-isrc", "-XOverloadedStrings", "src/System/Posix/FilePath"]+main = do+ doctest+ [ "-isrc"+ , "-XOverloadedStrings"+ , "src/System/Posix/FilePath"+ ]+ runTestTT unitTests++unitTests :: Test+unitTests = test+ [ TestCase $ do+ r <- (==) <$> allDirectoryContents "." <*> allDirectoryContents' "."+ assertBool "allDirectoryContents == allDirectoryContents'" r+ ]
posix-paths.cabal view
@@ -1,9 +1,9 @@ name: posix-paths-version: 0.1.1.0+version: 0.1.1.1 license: BSD3 license-file: LICENSE maintainer: jwlato@gmail.com-bug-reports: http://hackage.haskell.org/trac/ghc/newticket?component=libraries/unix+bug-reports: http://github.com/JohnLato/posix-paths/issues synopsis: POSIX filepath/directory functionality category: System description:@@ -38,7 +38,8 @@ bytestring, unix, posix-paths,- doctest >= 0.8+ doctest >= 0.8,+ HUnit benchmark bench.hs default-language: Haskell2010
src/System/Posix/Directory/Traversals.hs view
@@ -70,13 +70,17 @@ -- | Get all files from a directory and its subdirectories strictly. --+--+ allDirectoryContents' :: RawFilePath -> IO [RawFilePath] allDirectoryContents' = fmap reverse . traverseDirectory (\acc fp -> return (fp:acc)) [] -- this uses traverseDirectory because it's more efficient than forcing the -- lazy version. --- recursively apply the 'action' to the parent directory and all+-- | Recursively apply the 'action' to the parent directory and all -- files/subdirectories.+--+-- This function allows for memory-efficient traversals. traverseDirectory :: (s -> RawFilePath -> IO s) -> s -> RawFilePath -> IO s traverseDirectory act s0 topdir = bracket someOpenFunc Posix.closeFd toploop where