Consider the following non sense type
type t =
| Int of int
| String of string
| Plus of (t * t)
| Neg of t
it forms a ‘tree’. I want to auto derive the following type
type t2 =
| Int of int
| String of string
| Plus of (idx, idx)
| Neg of idx
and the corresponding conversion functions for t <-> t2 list
Of course need t to be non-cyclic, and not all valid t2 list
are valid t
.
Questions:
-
Is there a name for this
tree <-> list
transform ? -
Is there an ocaml ppx to auto derive the types ?
Thanks!