Skip to content

Commit 5581352

Browse files
committed
Backport to OCaml 4.08
1 parent e16e1d1 commit 5581352

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lib/fake/atomic.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type 'a t = 'a ref
2+
3+
let make x = ref x
4+
let get x = !x
5+
let set atomic v = atomic := v
6+
7+
let fetch_and_add atomic n =
8+
let v = !atomic in
9+
atomic := v + n;
10+
v

lib/import.ml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
module List = Stdlib.ListLabels
1+
module List = struct
2+
let[@warning "-32"] rec equal ~eq l1 l2 = match l1, l2 with
3+
| [], [] -> true
4+
| [], _::_ | _::_, [] -> false
5+
| x::xs, y::ys -> if eq x y then equal ~eq xs ys else false
6+
7+
let[@warning "-32"] rec compare ~cmp l1 l2 = match l1, l2 with
8+
| [], [] -> 0
9+
| [], _::_ -> -1
10+
| _::_, [] -> 1
11+
| x::xs, y::ys ->
12+
let r = cmp x y in
13+
if r = 0 then compare ~cmp xs ys else r
14+
15+
include Stdlib.ListLabels
16+
end
217

318
module Poly = struct
419
let equal = ( = )

0 commit comments

Comments
 (0)