I recently wrote ppx_make
and now it is available on opam! This package is not a direct reimplement of the make
deriver in ppx_deriving
, but very similar. It has several differences (the list might not be complete):
- add support for option:
val make_t : ?value:t -> unit -> t
- add support for tuple:
val make_t : ?v0 -> ?v1 -> ... -> unit -> t
- add support for variant, including embedded record:
make_choice_name_of_t : ... -> unit -> t
- add support for multiple
[@main]
in record -
unit
is required for all make function unless[@main]
presents. This is to ensure forward-compatibility- i.e. the use of the make of
{ a:int; b:int }
will work with the make of{ a:int; b:int; c:int option }
- i.e. the use of the make of
- ditch the
[@split]