[Haskell-cafe] directory tree?

Bryan O'Sullivan bos at serpentine.com
Sun Jun 24 12:35:55 EDT 2007


Chad Scherrer wrote:

> What got me thinking about this is I'd like to be able to do something
> like this in just a couple lines of code:
> 
> gunzip -c ./2*/*.z
> 
> ... and feed the result into a giant lazy ByteString.

Using my FileManip library, you'd do that like this.

import Codec.Compression.GZip
import qualified Data.ByteString.Lazy as B
import System.FilePath.Glob

foo :: IO B.ByteString
foo = namesMatching "*/*.gz" >>=
       fmap B.concat . mapM (fmap decompress . B.readFile)

http://hackage.haskell.org/cgi-bin/hackage-scripts/package/FileManip-0.2

	<b


More information about the Haskell-Cafe mailing list