Skip to content

Commit

Permalink
update schema fonction to use the latest iter in the schema function
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucccyo committed Dec 18, 2024
1 parent 5f775b5 commit 528e2b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/index-format/granular_map.ml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module type S = sig
val mem: key -> 'a t -> bool
val update: key -> ('a option -> 'a option) -> 'a t -> 'a t
val schema: Granular_marshal.iter ->
(key -> 'a -> unit) -> 'a s Granular_marshal.link -> unit
(key -> 'a -> Granular_marshal.iter -> unit) -> 'a s Granular_marshal.link -> unit
end

module Make (Ord : OrderedType) = struct
Expand Down Expand Up @@ -273,11 +273,11 @@ module Make (Ord : OrderedType) = struct
let rr = update x f r in
if r == rr then link m else bal l v d rr

let rec schema iter f m =
let rec schema iter (f: key -> 'a -> Granular_marshal.iter -> unit) m =
iter.yield m
@@ fun iter tree ->
match tree with
| Empty -> ()
| Node {l; v; d; r; _} -> schema iter f l ; f v d ; schema iter f r
| Node {l; v; d; r; _} -> schema iter f l ; f v d iter ; schema iter f r
end

2 changes: 1 addition & 1 deletion src/index-format/granular_map.mli
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module type S = sig
val mem: key -> 'a t -> bool
val update: key -> ('a option -> 'a option) -> 'a t -> 'a t
val schema: Granular_marshal.iter ->
(key -> 'a -> unit) -> 'a s Granular_marshal.link -> unit
(key -> 'a -> Granular_marshal.iter -> unit) -> 'a s Granular_marshal.link -> unit
end

module Make (Ord : OrderedType) : S with type key = Ord.t
Expand Down
4 changes: 2 additions & 2 deletions src/index-format/index_format.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ type index =
let lidset_schema iter lidset = Lid_set.schema iter (fun _v -> ()) lidset

let index_schema (iter: Granular_marshal.iter) index =
Uid_map.schema iter (fun _ v -> lidset_schema iter v) index.defs;
Uid_map.schema iter (fun _ v -> lidset_schema iter v) index.approximated
Uid_map.schema iter (fun _ v iter -> lidset_schema iter v) index.defs;
Uid_map.schema iter (fun _ v iter -> lidset_schema iter v) index.approximated

let pp_partials (fmt : Format.formatter) (partials : Lid_set.t Uid_map.t) =
Format.fprintf fmt "{@[";
Expand Down

0 comments on commit 528e2b1

Please sign in to comment.