Skip to content

Commit

Permalink
Lwt_react: use physical equality internally to implement S.l[2-6]_s
Browse files Browse the repository at this point in the history
This avoids a failure when some inputs cannot be compared (if they
contain functional values, for instance).
We need to do something anyway if one of the inputs changes, so it makes
sense to use physical equality here.
  • Loading branch information
vouillon committed Oct 12, 2021
1 parent cf31596 commit 53bbf83
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/react/lwt_react.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -455,19 +455,19 @@ module S = struct
map_s ?eq f s1

let l2_s ?eq f s1 s2 =
map_s ?eq (fun (x1, x2) -> f x1 x2) (l2 (fun x1 x2 -> (x1, x2)) s1 s2)
map_s ?eq (fun (x1, x2) -> f x1 x2) (l2 ~eq:(==) (fun x1 x2 -> (x1, x2)) s1 s2)

let l3_s ?eq f s1 s2 s3 =
map_s ?eq (fun (x1, x2, x3) -> f x1 x2 x3) (l3 (fun x1 x2 x3-> (x1, x2, x3)) s1 s2 s3)
map_s ?eq (fun (x1, x2, x3) -> f x1 x2 x3) (l3 ~eq:(==) (fun x1 x2 x3-> (x1, x2, x3)) s1 s2 s3)

let l4_s ?eq f s1 s2 s3 s4 =
map_s ?eq (fun (x1, x2, x3, x4) -> f x1 x2 x3 x4) (l4 (fun x1 x2 x3 x4-> (x1, x2, x3, x4)) s1 s2 s3 s4)
map_s ?eq (fun (x1, x2, x3, x4) -> f x1 x2 x3 x4) (l4 ~eq:(==) (fun x1 x2 x3 x4-> (x1, x2, x3, x4)) s1 s2 s3 s4)

let l5_s ?eq f s1 s2 s3 s4 s5 =
map_s ?eq (fun (x1, x2, x3, x4, x5) -> f x1 x2 x3 x4 x5) (l5 (fun x1 x2 x3 x4 x5-> (x1, x2, x3, x4, x5)) s1 s2 s3 s4 s5)
map_s ?eq (fun (x1, x2, x3, x4, x5) -> f x1 x2 x3 x4 x5) (l5 ~eq:(==) (fun x1 x2 x3 x4 x5-> (x1, x2, x3, x4, x5)) s1 s2 s3 s4 s5)

let l6_s ?eq f s1 s2 s3 s4 s5 s6 =
map_s ?eq (fun (x1, x2, x3, x4, x5, x6) -> f x1 x2 x3 x4 x5 x6) (l6 (fun x1 x2 x3 x4 x5 x6-> (x1, x2, x3, x4, x5, x6)) s1 s2 s3 s4 s5 s6)
map_s ?eq (fun (x1, x2, x3, x4, x5, x6) -> f x1 x2 x3 x4 x5 x6) (l6 ~eq:(==) (fun x1 x2 x3 x4 x5 x6-> (x1, x2, x3, x4, x5, x6)) s1 s2 s3 s4 s5 s6)

(* +---------------------------------------------------------------+
| Monadic interface |
Expand Down

0 comments on commit 53bbf83

Please sign in to comment.