[Haskell-cafe] directory tree?

Chad Scherrer chad.scherrer at gmail.com
Sun Jun 24 18:47:51 EDT 2007

Thanks, Bryan, this is much cleaner than the imperative hack I was
throwing together. And aside from the imports, it even fits the
"couple lines of code" criteria! Wonderful.

I won't be able to try this out until I get back to work, but I'm
wondering whether this will handle a few thousand files. As it is,
even the "gunzip -c ./2*/*.z" I'm trying to emulate doesn't really
work as is, because the OS complains there are too many pattern

Does "namesMatching" just feed the pattern to the OS, or does it match
the pattern itself?


> > 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)

More information about the Haskell-Cafe mailing list