ppx_deriving_yojson icon indicating copy to clipboard operation
ppx_deriving_yojson copied to clipboard

cycle detection

Open vogler opened this issue 8 years ago • 0 comments
trafficstars

Currently, cyclic values lead to a stack overflow. It would be nice to have some option (maybe just for debugging) to get some information where a cycle happened.

# type t = A of t | B [@@deriving to_yojson]
type t = A of t | B
val to_yojson : t -> Yojson.Safe.json = <fun>
# to_yojson B
- : Yojson.Safe.json = `List [`String "B"]
# let rec x = A x
val x : t = A <cycle>
# to_yojson x
Stack overflow during evaluation (looping recursion?).
Raised by primitive operation at file "//toplevel//", line 1, characters 0-42                                         Called from file "//toplevel//", line 1, characters 0-42

vogler avatar May 23 '17 13:05 vogler