-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_debug_pp.ml
27 lines (20 loc) · 926 Bytes
/
test_debug_pp.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
module Debug_runtime =
(val Minidebug_runtime.debug_flushing ~filename:"debugger_pp_flushing" ())
type t = { first : int; second : int } [@@deriving show]
type num = int [@@deriving show]
let%debug_pp bar (x : t) : num =
let y : num = x.first + 1 in
x.second * y
let () = ignore @@ bar { first = 7; second = 42 }
let%debug_pp baz (x : t) : num =
let ({ first = y; second = z } as _yz) : t = { first = x.first + 1; second = 3 } in
(x.second * y) + z
let () = ignore @@ baz { first = 7; second = 42 }
let%debug_pp rec loop (depth : num) (x : t) : num =
if depth > 6 then x.first + x.second
else if depth > 3 then loop (depth + 1) { first = x.second + 1; second = x.first / 2 }
else
let y : num = loop (depth + 1) { first = x.second - 1; second = x.first + 2 } in
let z : num = loop (depth + 1) { first = x.second + 1; second = y } in
z + 7
let () = ignore @@ loop 0 { first = 7; second = 42 }