mte/unikernel/duniverse/ppxlib/examples/simple-deriver/README.md
2025-11-11 02:07:51 +01:00

469 B

ppx_deriving_accessors

This folder contains an example of a very simple ppx deriver that will generate accessors for record fields from the record type definition.

E.g. the following:

type t =
  { a : string
  ; b : int
  }
  [@@deriving accessors]

will generate the following:

let a x = x.a
let b x = x.b

It can also be used in .mli files to generate the corresponding signatures:

val a : t -> string
val b : t -> int