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
|
(* TEST
* expect
*)
type (_, _) eqp = Y : ('a, 'a) eqp | N : string -> ('a, 'b) eqp
let f : ('a list, 'a) eqp -> unit = function N s -> print_string s;;
module rec A : sig type t = B.t list end =
struct type t = B.t list end
and B : sig type t val eq : (B.t list, t) eqp end =
struct
type t = A.t
let eq = Y
end;;
f B.eq;;
[%%expect{|
type (_, _) eqp = Y : ('a, 'a) eqp | N : string -> ('a, 'b) eqp
Line 2, characters 36-66:
2 | let f : ('a list, 'a) eqp -> unit = function N s -> print_string s;;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Warning 8 [partial-match]: this pattern-matching is not exhaustive.
Here is an example of a case that is not matched:
Y
val f : ('a list, 'a) eqp -> unit = <fun>
module rec A : sig type t = B.t list end
and B : sig type t val eq : (B.t list, t) eqp end
Exception: Match_failure ("", 2, 36).
|}];;
|