Skip to content

Instantly share code, notes, and snippets.

@davidallsopp
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save davidallsopp/9fbe3e883d2021390f03 to your computer and use it in GitHub Desktop.

Select an option

Save davidallsopp/9fbe3e883d2021390f03 to your computer and use it in GitHub Desktop.
Listing entries in a ZIP archive using zip-conduit in Haskell (https://hackage.haskell.org/package/zip-conduit-0.2.2.1/docs/Codec-Archive-Zip.html)
module ZipConduit1 where
-- requires zip-conduit package
-- slightly adapted from the docs at:
-- https://hackage.haskell.org/package/zip-conduit-0.2.2.1/docs/Codec-Archive-Zip.html
import Codec.Archive.Zip
main :: IO ()
main = do
names <- withArchive "test.zip" entryNames
mapM_ putStrLn names
-- or equivalently using >>=
main2 :: IO ()
main2 = withArchive "test.zip" entryNames >>= mapM_ putStrLn
-- or equivalently using =<<
main3 :: IO ()
main3 = mapM_ putStrLn =<< withArchive "test.zip" entryNames
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment