[Haskell-cafe] Re: walking a directory tree efficiently

Paolo Losi paolo at hypersonic.it
Mon Jan 19 03:51:01 EST 2009

Massimiliano Gubinelli wrote:
> Hi,
>  what about avoid the use of the unfold over the tree and construct it
> directly (e.g. see http://hpaste.org/13919#a3)? 

Nice solution!

> I wonder if there is (an
> easy) possibility to construct the tree lazily so that output start
> immediately for large trees.

I think the modular approach would be that of using
a fold-left enumerator that produces the list of paths
and navigation operations by traversing the dir hierarchy "Depth First":

data DirTraversalInfo = Path String
                       | DirUp
		      | DirDown

I guess you know:

> best,
> Massimiliano Gubinelli


More information about the Haskell-Cafe mailing list