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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
(* TEST
expect;
*)
type ('a, 'b) eq = Refl : ('a, 'a) eq
type empty = (int, string) eq
type ('a, 'b) t = Left : 'a -> ('a, 'b) t | Right : 'b -> ('a, 'b) t;;
[%%expect{|
type ('a, 'b) eq = Refl : ('a, 'a) eq
type empty = (int, string) eq
type ('a, 'b) t = Left : 'a -> ('a, 'b) t | Right : 'b -> ('a, 'b) t
|}]
let f1 x =
match x with
| (None : empty option) -> ()
;;
[%%expect {|
val f1 : empty option -> unit = <fun>
|}]
let f2 () =
match None with
| (None : empty option) -> ()
;;
[%%expect {|
val f2 : unit -> unit = <fun>
|}]
let f3 () =
let x = None in
match x with
| (None : empty option) -> ()
;;
[%%expect {|
val f3 : unit -> unit = <fun>
|}]
let f1' x =
match x with
| (None : empty option) -> ()
| Some _ -> .
;;
[%%expect {|
val f1' : empty option -> unit = <fun>
|}]
let f2' () =
match None with
| (None : empty option) -> ()
| Some _ -> .
;;
[%%expect {|
val f2' : unit -> unit = <fun>
|}]
let f3' () =
let x = None in
match x with
| (None : empty option) -> ()
| Some _ -> .
;;
[%%expect {|
val f3' : unit -> unit = <fun>
|}]
let (Left () : (unit, empty) t) = Left ();;
[%%expect {|
|}]
let f () =
let Left () = (Left () : (unit, empty) t) in
()
;;
[%%expect {|
val f : unit -> unit = <fun>
|}]
let f () =
let (Left () : (unit, empty) t) = Left () in
()
;;
[%%expect{|
val f : unit -> unit = <fun>
|}]
let f () =
match (Left () : (unit, empty) t) with
| Left () -> ()
;;
[%%expect {|
val f : unit -> unit = <fun>
|}]
let f () =
match (Left () : (unit, empty) t) with
| Left () -> ()
| Right _ -> .
;;
[%%expect {|
val f : unit -> unit = <fun>
|}]
let f () =
match Left () with
| (Left () : (unit, empty) t) -> ()
;;
[%%expect {|
val f : unit -> unit = <fun>
|}]
let f () =
match Left () with
| (Left () : (unit, empty) t) -> ()
| (Right _ : (unit, empty) t) -> .
;;
[%%expect {|
val f : unit -> unit = <fun>
|}]
|