A simple ppx to examplify the initial setup of ppxlib, part of the talk The needed introduction to writing a ppx given at Reason STHLM Meetup..
It uses esy
since it's a little easier to install sandboxes enviroments than opam.
- OCaml 4.14
- dune 3.4.1
- ppxlib 0.27
Needs esy
installed globally in your system, if you don't have it install it with npm: npm install -g esy
.
esy # Installs the dependencies and builds the project
esy add @opam/ocaml-lsp-server
esy build # Builds the project, once
esy watch # Watch the filesystem and re-builds the project on each change
esy test # Runs alcotest tests
Users of your ppx need to add this to their dune for your executable to be executed as ppx (or inside bsconfig if targeting ReScript).
(preprocess
(pps simple-ppx))
print_endline [%yay]
(* Transforms to *)
print_endline "r3p14ccd 70 r4nd0m 5tr1n9"