
Thanks again for the feedback! I've modified the zip-archive library along the lines you suggested. Version 0.1 is now available on HackageDB. John +++ Duncan Coutts [Aug 26 08 21:36 ]:
Generally it looks good, that the operations on the archive are mostly separated from IO of writing out archives or creating entries from disk files etc.
Looking at the API there feels to be slightly too much exposed. Eg does the MSDOSDateTime need to be exposed, or the (de)compressData functions.
My personal inclination is to leave off the Zip prefix in the names and use qualified imports. I'd also leave out trivial compositions like
readZipArchive f = toZipArchive <$> B.readFile f writeZipArchive f = B.writeFile f . fromZipArchive
but reasonable people disagree.
For both the pack in my tar lib and your addFilesToZipArchive, there's a getDirectoryContentsRecursive function asking to get out. This function seems to come up often. Ideally pack/unpack and addFilesToZipArchive/extractFilesFromZipArchive would just be mapM_ extract or create for an individual entry over the contents of the archive or the result of a recursive traversal.
So yeah, I feel these operations ought to be simpler compositions of other things, in your lib and mine, since this bit is often the part where different use cases need slight variations, eg in how they write files, or deal with os-specific permissions/security stuff. So if these are compositions of simpler stuff it should be easier to add in extra stuff or replace bits.
Duncan