1 type t
= [`A
of int | `B
of string | `Z
of t
]
3 let rec use_t = function
5 | `B s
-> String.length s
9 : t
-> unit (* comment this *)
11 | `A i
-> print_endline
"A"
12 | `B s
-> print_endline
"B"
13 | `Z x
-> (print_string
"Z"; show_t x
)
15 let rec make_narrow = function
17 | `B s
-> `A
(String.length s
)
18 | `Z x
-> `Z
(make_narrow x
)
20 let rec use_narrow = function
22 | `Z x
-> (use_narrow x
)
27 let y = make_narrow x
in
31 let final x
= use_narrow (make_narrow (tee show_t x
))
34 use_narrow (tee (fun (z
:[`A
of int| `Z
of 'a
] as 'a
) -> show_t (z
:>t
)) (make_narrow x
))