summaryrefslogtreecommitdiff
path: root/lib/configuration/graph_tree.ml
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2026-11-19 08:47:29 +0100
committerSébastien Dailly <sebastien@dailly.me>2026-11-19 08:47:29 +0100
commita9628fda0fc027c54b5ed5313a0c41731d79e41f (patch)
tree9240bc709d0f93336b20fb3d6b3b6cb2e8a35423 /lib/configuration/graph_tree.ml
parent36e895119c80d52e0d3a3695a3cf3d93e41bcd3e (diff)
Create all the datatypes in a single time.
Use aliases for the type name for clarification
Diffstat (limited to 'lib/configuration/graph_tree.ml')
-rw-r--r--lib/configuration/graph_tree.ml23
1 files changed, 7 insertions, 16 deletions
diff --git a/lib/configuration/graph_tree.ml b/lib/configuration/graph_tree.ml
index 240c1c9..64cef40 100644
--- a/lib/configuration/graph_tree.ml
+++ b/lib/configuration/graph_tree.ml
@@ -7,7 +7,7 @@
cycle analysis. *)
module Vertex = struct
- type t = Model.Reference.t Model.Content.t
+ type t = Model.content
let compare t1 t2 =
Model.Identifier.compare (Model.Content.id t1) (Model.Content.id t2)
@@ -19,7 +19,7 @@ module Vertex = struct
end
module Edge = struct
- type t = Default | Field of Model.Reference.t Model.Field.t
+ type t = Default | Field of Model.field
let compare e1 e2 =
match (e1, e2) with
@@ -52,24 +52,15 @@ type t = G.t
let create : unit -> t = G.create
-let add_edge :
- t ->
- Model.Reference.t Model.Content.t ->
- Model.Reference.t Model.Field.t ->
- Model.Reference.t Model.Content.t ->
- unit =
+let add_edge : t -> Model.content -> Model.field -> Model.content -> unit =
fun t src field dst -> G.add_edge_e t (src, Edge.Field field, dst)
-let add_content : t -> Model.Reference.t Model.Content.t -> unit = G.add_vertex
+let add_content : t -> Model.content -> unit = G.add_vertex
let pp : Format.formatter -> t -> unit = GV_Printer.fprint_graph
+let fold : (Model.content -> 'a -> 'a) -> t -> 'a -> 'a = Topological.fold
+let iter : (Model.content -> unit) -> t -> unit = Topological.iter
-let fold : (Model.Reference.t Model.Content.t -> 'a -> 'a) -> t -> 'a -> 'a =
- Topological.fold
-
-let iter : (Model.Reference.t Model.Content.t -> unit) -> t -> unit =
- Topological.iter
-
-exception Cycle of Model.Reference.t Model.Content.t list
+exception Cycle of Model.content list
let check_cycle : t -> unit =
fun t -> Cycle.iter_cycles (fun vertexes -> raise_notrace (Cycle vertexes)) t