'Component-based Program Synthesis in OCaml' is a nice 2017 paper on program synthesis in OCaml. https://www-scf.usc.edu/~zhanpenl/prog_syn.pdf Some impressive examples, but programmatically generating friendly variable names remains a hard problem. JSNice is the only nice solution I've seen.