Module Slurp


module Slurp: sig .. end
Scans a directory lazily to build a tree that can be user-decorated.


type 'a entry =
| Dir of string * string * My_unix.stats Lazy.t * 'a * 'a entry list Lazy.t (*Dir(path, name, lst, decoration, lentries) is a directory named name whose path is path. Its stat is lazily stored in lst and its entries are lazily scanned in lentries. decoration is of type 'a.*)
| File of string * string * My_unix.stats Lazy.t * 'a (*File(path, name, lst, decoration) is a file named name whose path is path. Its stat is lazily stored in lst. decoration is of type 'a.*)
| Error of exn (*Error x means that the exception x was raised while scanning or statting an entry.*)
| Nothing (*Convenient when filtering out entries.*)
val slurp : string -> unit entry
Recursively scan the filesystem starting at the given directory.
val filter : (string -> string -> 'a -> bool) -> 'a entry -> 'a entry
filter f entry only retains from entry the nodes for which f path name returns true.
val map : (string -> string -> 'a -> 'b) -> 'a entry -> 'b entry
map f entries changes the decoration in entries by applying f to them. f is called as f path name decoration.
val fold : (string -> string -> 'a -> 'b -> 'b) -> 'a entry -> 'b -> 'b
fold f entry x iterates f over the entries and an accumulator initially containing x; at each iteration, f gets the current value of the accumulator and returns its new value.
val force : 'a entry -> unit
Force the evaluation of the whole entry.