ListTree-0.2.0: Trees and monadic trees expressed as monadic lists where the underlying monad is a list



Monadic directory tree.

 -- List of files under "." or subfolders with ".markdown" extension,
 -- except for those with a name starting with "_" somewhere in their path. (like "_cache/index.markdown")
 markdownFiles :: ListT IO FilePath
     = filter ((== ".markdown") . takeExtension) -- only take files with a ".markdown" extension
     . lastL                                     -- get the leaves of the tree (files, not directories)
     . scanl1 appendPath                         -- transform tree nodes to filenames including path
     . prune (not . isPrefixOf "_")              -- ignore directories or files whose name starts with "_"
     $ directoryTree "."                         -- directory tree starting at "."

Module name System.Directory.Tree is a better fit but it is taken by directory-tree, a read-directory-tree-in-bulk module.



appendPath :: FilePath -> FilePath -> FilePathSource

When used with scanl or scanl1, transforms tree of filenames to tree of filenames with the paths