This module provides functions for traversing a filesystem hierarchy.
The
find function generates a lazy list of matching files,
while
fold performs a left fold.
Both
find and
fold allow fine control over recursion,
using the
FindClause type. This type is also used to pre-filter
the results returned by
find.
The
FindClause type lets you write filtering and recursion
control expressions clearly and easily.
For example, this clause matches C source files.
extension ==? ".c" ||? extension ==? ".h"
Because
FindClause is a monad, you can use the usual monad
machinery to, for example, lift pure functions into it.
Here's a clause that will return
True for any file whose
directory name contains the word
"temp".
(isInfixOf "temp") `liftM` directory