I have a project with some boilerplate-y implementation code that I would like to extract out, and cppo’s #define macros are perfect for what I would like to do.
However, ocamlformat (which I invoke in the terminal with
dune fmt) doesn’t seem to work with files that use foreign cppo syntax (it reports invalid syntax which makes sense since it’s trying to format the file before processing).
I was wondering if anyone had any solutions? [This Stack Overflow answer)[ocaml - use ocamlformat with cppo and dune - Stack Overflow] asks about the same question as well, but I’m a bit lost with the answer because I’m not familiar with OCaml beyond writing code in the language (so the inticracies involving Dune and Makefiles is lost on me).
Would appreciate any help. If my question doesn’t have an answer, that’s okay and I’ll just have ocamlformat ignore the preprocessed files. Thanks in advance.
(I’m open to other ideas of reducing boilerplate instead of using cppo too.)