This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
28
unikernel/duniverse/ppxlib/examples/simple-deriver/README.md
Normal file
28
unikernel/duniverse/ppxlib/examples/simple-deriver/README.md
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
# 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:
|
||||
|
||||
```ocaml
|
||||
type t =
|
||||
{ a : string
|
||||
; b : int
|
||||
}
|
||||
[@@deriving accessors]
|
||||
```
|
||||
|
||||
will generate the following:
|
||||
|
||||
```ocaml
|
||||
let a x = x.a
|
||||
let b x = x.b
|
||||
```
|
||||
|
||||
It can also be used in `.mli` files to generate the corresponding signatures:
|
||||
|
||||
```ocaml
|
||||
val a : t -> string
|
||||
val b : t -> int
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue