[Haskell-cafe] Filesystem questions
gale at sefer.org
Sun Oct 14 06:43:38 EDT 2007
>>> ...a tool for recursing through directories...
>>> How about a built-in function that represents a directory tree
>>> as a lazy Data.Tree?
Bryan O'Sullivan wrote:
>> See System.FilePath.Find in
> -- List all directories in the tree rooted at the given path
> traverseDirectories :: MonadIO m =>
> TraversalDirection -> FilePath -> ListT m Directory
> You could plug the above into your machinery for
> "recursion predicates" and all the other nice stuff.
Or - getting back to the "lazy Data.Tree" idea -
we could define TreeT, analgous to ListT:
newtype TreeT m a = NodeT (m (a, TreeT (ListT m) a))
and give it a nice Monad instance. Then you can prune
and filter trees in a natural way, inside the monad.
More information about the Haskell-Cafe