forked from ocaml-flambda/flambda-backend
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathallowance.ml
58 lines (43 loc) · 2.17 KB
/
allowance.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(**************************************************************************)
(* *)
(* OCaml *)
(* *)
(* Richard Eisenberg, Jane Street, New York *)
(* *)
(* Copyright 2024 Jane Street Group LLC *)
(* *)
(* All rights reserved. This file is distributed under the terms of *)
(* the GNU Lesser General Public License version 2.1, with the *)
(* special exception on linking described in the file LICENSE. *)
(* *)
(**************************************************************************)
type allowed = private Allowed
type disallowed = private Disallowed
type left_only = allowed * disallowed
type right_only = disallowed * allowed
type both = allowed * allowed
module type Allow_disallow = sig
type ('a, 'b, 'd) sided constraint 'd = 'l * 'r
val disallow_right :
('a, 'b, 'l * 'r) sided -> ('a, 'b, 'l * disallowed) sided
val disallow_left : ('a, 'b, 'l * 'r) sided -> ('a, 'b, disallowed * 'r) sided
val allow_right : ('a, 'b, 'l * allowed) sided -> ('a, 'b, 'l * 'r) sided
val allow_left : ('a, 'b, allowed * 'r) sided -> ('a, 'b, 'l * 'r) sided
end
module Magic_allow_disallow (X : Allow_disallow) :
Allow_disallow with type ('a, 'b, 'd) sided = ('a, 'b, 'd) X.sided = struct
type ('a, 'b, 'd) sided = ('a, 'b, 'd) X.sided
let disallow_right :
type a b l r. (a, b, l * r) sided -> (a, b, l * disallowed) sided =
Obj.magic
let disallow_left :
type a b l r. (a, b, l * r) sided -> (a, b, disallowed * r) sided =
Obj.magic
let allow_right :
type a b l r. (a, b, l * allowed) sided -> (a, b, l * r) sided =
Obj.magic
let allow_left :
type a b l r. (a, b, allowed * r) sided -> (a, b, l * r) sided =
Obj.magic
end
[@@inline]