-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use ppx to reduce boilerplate code #31
Comments
Add a package setting toplevel printers
At some point I found ppx_yojson, which attempts to simplify manual creation of Yojson values, e.g. by converting OCaml record-like syntax to a JSON object. It's not for deriving anything but just avoids having to construct Yojson values directly using its constructors. This might be useful for manual implementations of |
I happened upon ppx_type_directed_value, which Jane Street just has, but I've never heard of anyone using. Its idea being to make custom deriving plugins easier to define by not having to write a ppx deriver from scratch but just define the behavior for product and sum types and have it automagically work for all tuples, records, etc. It sounds like a nice way to define our own lattice derivers, but it adds the Jane Street Base dependency and has notable performance implications:
In their benchmarking example they reimplement equality deriving, which via this ppx is ~4× slower than a direct equality deriver. So I'm a bit skeptical if it'd be fast enough to replace our currently hand-written lattice definitions. |
Use type-driven code generation to get rid of boilerplate (see ppx_deriving):
yojson
for output of domains values (see Possibly excessive functions inPrintable.S
#210)show
for output of domains values (see Migrate from CIL'sPretty
to OCaml'sFormat
#213)eq
,ord
for domains (PR Reduce equal & compare boilerplate using deriving eq & ord #227)hash
: ppx_hash exists, but depends on and builds around Jane StreetBase
hash stuff, which conflicts with ourbase.ml
..., and it doesn't seem to support all the primitive typeseq
andord
derivers do (e.g.char
); alternatively implement own more direct deriver https://github.com/sim642/ppx_deriving_hash?relift
(Add PPX derivers for lattices of tuple and record types #1095), PR Add PPX derivers for lattices of tuple and record types #1095)ppx-lattice
branchname ()
from Domain nameThe text was updated successfully, but these errors were encountered: