1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
type t = Path.Set.t
let empty = Path.Set.empty
let add = Path.Set.add
let from_list = Path.Set.of_list
let diff ~target computed = Path.Set.diff target computed |> Path.Set.to_list
let from_directory ~on target =
let open Eff.Syntax in
let rec aux trace parent =
let* children = Eff.read_directory ~on ~only:`Both parent in
Stdlib.List.fold_left
(fun trace child ->
let* trace = trace in
let* as_file = Eff.is_file ~on child in
if as_file then Eff.return (add child trace) else aux trace child)
(Eff.return trace) children
in
aux empty target
let equal = Path.Set.equal
let pp ppf trace =
Format.fprintf ppf "Trace[@[%a@]]"
(Format.pp_print_list (fun ppf p ->
Format.fprintf ppf "%S" (Path.to_string p)))
(trace |> Path.Set.to_list)