filesystem-conduit 0.4.0 → 0.5.0
raw patch · 3 files changed
+16/−18 lines, 3 filesdep ~conduitPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: conduit
API changes (from Hackage documentation)
- Data.Conduit.Filesystem: sinkFile :: MonadResource m => FilePath -> Sink ByteString m ()
+ Data.Conduit.Filesystem: sinkFile :: MonadResource m => FilePath -> GInfSink ByteString m
- Data.Conduit.Filesystem: sourceFile :: MonadResource m => FilePath -> Source m ByteString
+ Data.Conduit.Filesystem: sourceFile :: MonadResource m => FilePath -> GSource m ByteString
- Data.Conduit.Filesystem: traverse :: MonadIO m => Bool -> FilePath -> Source m FilePath
+ Data.Conduit.Filesystem: traverse :: MonadIO m => Bool -> FilePath -> GSource m FilePath
Files
- Data/Conduit/Filesystem.hs +13/−15
- filesystem-conduit.cabal +2/−2
- test/main.hs +1/−1
Data/Conduit/Filesystem.hs view
@@ -21,7 +21,7 @@ import Prelude hiding (FilePath) import Control.Monad.IO.Class (MonadIO, liftIO)-import qualified Data.Conduit as C+import Data.Conduit import qualified Data.Conduit.Binary as CB import Filesystem import Filesystem.Path.CurrentOS (FilePath, encodeString)@@ -41,24 +41,22 @@ traverse :: MonadIO m => Bool -- ^ Follow directory symlinks (only used on POSIX platforms) -> FilePath -- ^ Root directory- -> C.Source m FilePath-traverse followSymlinks root = C.PipeM- (liftIO (listDirectory root) >>= pull)- (return ())+ -> GSource m FilePath+traverse _followSymlinks root =+ liftIO (listDirectory root) >>= pull where- mkSrc ps = C.PipeM (pull ps) (return ())-- pull [] = return $ C.Done Nothing ()+ pull [] = return () pull (p:ps) = do isFile' <- liftIO $ isFile p if isFile'- then return $ C.HaveOutput (mkSrc ps) (return ()) p+ then yield p >> pull ps else do follow' <- liftIO $ follow p if follow' then do ps' <- liftIO $ listDirectory p- pull $ ps ++ ps'+ pull ps+ pull ps' else pull ps follow :: FilePath -> IO Bool@@ -67,20 +65,20 @@ #else follow p = do let path = encodeString p- stat <- if followSymlinks+ stat <- if _followSymlinks then Posix.getFileStatus path else Posix.getSymbolicLinkStatus path return (Posix.isDirectory stat) #endif -- | Same as 'CB.sourceFile', but uses system-filepath\'s @FilePath@ type.-sourceFile :: C.MonadResource m+sourceFile :: MonadResource m => FilePath- -> C.Source m S.ByteString+ -> GSource m S.ByteString sourceFile = CB.sourceFile . encodeString -- | Same as 'CB.sinkFile', but uses system-filepath\'s @FilePath@ type.-sinkFile :: C.MonadResource m+sinkFile :: MonadResource m => FilePath- -> C.Sink S.ByteString m ()+ -> GInfSink S.ByteString m sinkFile = CB.sinkFile . encodeString
filesystem-conduit.cabal view
@@ -1,5 +1,5 @@ Name: filesystem-conduit-Version: 0.4.0+Version: 0.5.0 Synopsis: Use system-filepath data types with conduits. Description: Provides ability to traverse a folder structure efficiently, as well as convenience wrappers for reading from and writing to files. License: BSD3@@ -21,7 +21,7 @@ , system-filepath >= 0.4.3 && < 0.5 , bytestring >= 0.9 , text >= 0.11- , conduit >= 0.4 && < 0.5+ , conduit >= 0.5 && < 0.6 ghc-options: -Wall if os(windows)
test/main.hs view
@@ -31,5 +31,5 @@ -} main :: IO ()-main = hspecX $ do+main = hspec $ do return ()