I’m trying to solve the problem, where a nested record or a tuple of records could be represented with the same API as the single record.
type alpha =
{
a1 : int ;
a2 : float ;
}
type beta =
{
b1 : int ;
b2 : string ;
}
type t = alpha * beta
I would like the result of application of deriving to t
to look like
val a1 : t -> int
val a2 : t -> float
val b1 : t -> int
val b2 : t -> string
I would like to avoid writing any boilerplate code, e.g. let a1 = (* extract from alpha, then apply ppx_derive'd function *)
.
That is, an effect equivalent to
type t =
{
a1 : int ;
a2 : float ;
b1 : int ;
b2 : string ;
}
[@@deriving fields]
How may I achieve this outcome? Is it possible to issue some parameters to one of the ppxs from ppx_jane
? Some other ones?