FilePather 0.1.3 → 0.1.4
raw patch · 3 files changed
+25/−29 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ System.FilePath.FilePather.Find: findHere :: Find f => FilterPredicateT f -> RecursePredicateT f -> IO [FilePath]
- System.FilePath.FilePather.Find: class Find f
+ System.FilePath.FilePather.Find: class Find f where findHere f r = getCurrentDirectory >>= find f r
Files
- FilePather.cabal +1/−12
- src/System/FilePath/FilePather/FilterPredicate.hs +1/−1
- src/System/FilePath/FilePather/Find.hs +23/−16
FilePather.cabal view
@@ -1,5 +1,5 @@ Name: FilePather-Version: 0.1.3+Version: 0.1.4 Author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> Maintainer: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ> Copyright: Tony Morris@@ -9,17 +9,6 @@ Category: System Description: Functions over @System.FilePath@ including a find function for recursing down directories.- .- /This package is similar to the filemanip package but without the mtl dependency./- .- Usage example:- .- @- -- find all haskell source files in the current directory, recursing all the way down- findHere always (extensionEq \"hs\") >>= mapM_ putStrLn- .\/Setup.hs- .\/System\/FilePath\/FilePather.hs- @ Homepage: https://github.com/tonymorris/filepather Cabal-version: >= 1.6 Build-Type: Simple
src/System/FilePath/FilePather/FilterPredicate.hs view
@@ -25,7 +25,7 @@ (FilePath -> FileType -> f Bool) -> FilterPredicateT f filterPredicateT =- filterPredicateT+ FilterPredicateT -- | Construct a filter predicate that does not require effects to compute its result. filterPredicate ::
src/System/FilePath/FilePather/Find.hs view
@@ -18,6 +18,13 @@ -> RecursePredicateT f -> FilePath -> IO [FilePath]+ -- | Find files in the current directory.+ findHere ::+ FilterPredicateT f+ -> RecursePredicateT f+ -> IO [FilePath]+ findHere f r =+ getCurrentDirectory >>= find f r instance Find Identity where find f' r' p = @@ -31,17 +38,17 @@ -> [FilePath] keep u = if u then (p:) else id- rkeep :: - [FilePath]- -> Bool+ rkeep :: + Bool+ -> [FilePath] -> IO [FilePath]- rkeep d u =+ rkeep u d = return (keep u d) trkeep :: FileType -> IO [FilePath]- trkeep t =- rkeep [] $ runIdentity (f p t)+ trkeep =+ flip rkeep [] . runIdentity . f p in do fe <- doesFileExist p if fe then@@ -55,10 +62,10 @@ in if l then do t <- getDirectoryContents p- u <- liftM concat $ forM (filter (`notElem` [".", ".."]) t) (find f' r')- rkeep u k+ u <- forM (filter (`notElem` [".", ".."]) t) (find f' r')+ rkeep k (concat u) else- rkeep [] k+ rkeep k [] else trkeep Unknown @@ -75,16 +82,16 @@ keep u = if u then (p:) else id rkeep :: - [FilePath]- -> Bool+ Bool+ -> [FilePath] -> IO [FilePath]- rkeep d u =+ rkeep u d = return (keep u d) trkeep :: FileType -> IO [FilePath] trkeep t =- f p t >>= rkeep []+ f p t >>= flip rkeep [] in do fe <- doesFileExist p if fe then@@ -98,10 +105,10 @@ if l then do t <- getDirectoryContents p- u <- liftM concat $ forM (filter (`notElem` [".", ".."]) t) (find f' r')- rkeep u k+ u <- forM (filter (`notElem` [".", ".."]) t) (find f' r')+ rkeep k (concat u) else- rkeep [] k+ rkeep k [] else trkeep Unknown