zip-conduit 0.2.2 → 0.2.2.1
raw patch · 2 files changed
+28/−14 lines, 2 filesdep ~LibZipdep ~cerealdep ~criterion
Dependency ranges changed: LibZip, cereal, criterion, temporary, test-framework, test-framework-hunit, zip-archive
Files
- bench/Bench.hs +18/−5
- zip-conduit.cabal +10/−9
bench/Bench.hs view
@@ -8,10 +8,10 @@ import Data.Word import System.FilePath import System.IO+import System.Directory import Criterion.Config import Criterion.Main-import Criterion.Monad import System.IO.Temp import System.Random @@ -57,12 +57,12 @@ b f = map (\name -> bench name $ f dir name) names - -- | Creates source files for archiving and archives with those -- files. File name is the size of this file in bytes.-prepareFiles :: FilePath -- ^ the path to the directory for files+prepareFiles :: MonadIO m+ => FilePath -- ^ the path to the directory for files -> [Int] -- ^ sizes of files to create- -> Criterion ()+ -> m () prepareFiles dir sizes = liftIO $ forM_ sizes $ \s -> do let path = dir </> show s@@ -118,7 +118,7 @@ unZipArchive :: FilePath -> FilePath -> IO () unZipArchive dir name = do bytes <- B.readFile (dir </> name <.> "zip")- A.extractFilesFromArchive [] $ A.toArchive bytes+ withCurrentDirectory dir . A.extractFilesFromArchive [] $ A.toArchive bytes unLibZip :: FilePath -> FilePath -> IO ()@@ -126,3 +126,16 @@ bytes <- L.withArchive [] (dir </> name <.> "zip") $ L.fileContentsIx [] 0 withFile (dir </> name) WriteMode $ \h -> hPutStr h bytes+++------------------------------------------------------------------------------+-- Utils.++-- | Runs action in the specified current directory.+withCurrentDirectory :: FilePath -> IO a -> IO a+withCurrentDirectory path action = withSystemTempDirectory path $ \dir -> do+ current <- getCurrentDirectory+ setCurrentDirectory dir+ res <- action+ setCurrentDirectory current+ return res
zip-conduit.cabal view
@@ -1,5 +1,5 @@ Name: zip-conduit-Version: 0.2.2+Version: 0.2.2.1 Synopsis: Working with zip archives via conduits. Description: Working with zip archives via conduits. License: BSD3@@ -19,7 +19,7 @@ Build-depends: base >= 4.3 && < 5 , bytestring >= 0.9 && < 0.11- , cereal == 0.3.*+ , cereal >= 0.3 && < 0.5 , conduit >= 0.5.5 && < 1.1 , digest == 0.0.* , directory >= 1.1 && < 1.3@@ -56,9 +56,9 @@ , HUnit == 1.2.* , hpc >= 0.5 && < 0.7 , mtl == 2.1.*- , temporary == 1.1.*- , test-framework == 0.6.*- , test-framework-hunit == 0.2.*+ , temporary >= 1.1 && < 1.3+ , test-framework >= 0.6 && < 0.9+ , test-framework-hunit >= 0.2 && < 0.4 , time == 1.4.* , zip-conduit @@ -74,13 +74,14 @@ Build-depends: base >= 4.3 && < 5 , bytestring >= 0.9 && < 0.11- , criterion == 0.6.*+ , directory >= 1.1 && < 1.3+ , criterion >= 0.6 && < 0.9 , filepath == 1.3.*- , LibZip == 0.10.*+ , LibZip >= 0.10 && < 0.12 , random == 1.0.*- , temporary == 1.1.*+ , temporary >= 1.1 && < 1.3 , transformers == 0.3.*- , zip-archive == 0.1.*+ , zip-archive >= 0.1 && < 0.3 , zip-conduit Ghc-options: -Wall -fno-warn-unused-do-bind