selectFileTree with callback to sort/filter/select/expand
It would be useful to have a version of selectFileTree(Lazy)
that uses a callback to determine which elements should be selected, which directories should be expanded, how the elements should be ordered, and which elements should not appear at all. I'm thinking of something along the lines of:
/**
* Browse for files in a (lazy) tree structure.
*
* @param Whether multiple selection is allowed.
* @param The root directory.
* @param A callback that will be run with a list of file paths in every
* directory encountered. The task returns a list of file paths (possibly
* filtered or sorted) with for each file whether it should be selected
* (first boolean). The second boolean is only used for directories: when
* `True`, it expands the directory by default.
* @result The selected file paths.
*/
selectFileTreeWith :: // or selectFileTreeLazyWith
!Bool !FilePath
!([(FilePath,FileInfo)] -> Task [(FilePath,Bool,Bool)])
-> Task [FilePath]