Skip to content

Commit

Permalink
Write out Seq.equal to support 4.13
Browse files Browse the repository at this point in the history
Avoid using Seq.equal which was added in 4.14.
Initially fixed in #340 and then broken in #342.

Co-authored-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
Co-authored-by: Edwin Török <edwin.torok@cloud.com>
  • Loading branch information
3 people committed May 15, 2023
1 parent 9900b81 commit 7399887
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ module Equal = struct
let equal_option = Option.equal
let equal_result eq_o eq_e x y = Result.equal ~ok:eq_o ~error:eq_e x y
let equal_list = List.equal
let equal_seq = Seq.equal
let rec equal_seq eq s1 s2 = (* To support OCaml 4.13 as Seq.equal was added in 4.14 *)
let open Seq in
match s1 (), s2 () with
| Nil, Nil -> true
| Cons (a, an), Cons (b, bn) when eq a b -> equal_seq eq an bn
| _ -> false
let equal_array eq x y = Seq.equal eq (Array.to_seq x) (Array.to_seq y)
end

0 comments on commit 7399887

Please sign in to comment.