So, I've written a simple PPX for OCaml that transforms a silly DSL into some library calls
[%jsx div]
Becomes something like
ReactJS.create_element "div"
However, whenever I attempt to compile it, I get 'Unbound value ReactJS.create_element'. Strangely, though, if I get it to output the transformed code, then copy that code directly into the file, it compiles fine.
Do PPX syntax extensions need to be linked to any libraries their generated AST references? Am I missing something really silly?
I'm building my project with the following simple ocamlbuild command:
ocamlbuild -use-ocamlfind \
-package react,js_of_ocaml,js_of_ocaml.ppx \
-package reactjs,reactjs_ppx \
tutorial.byte tutorial.ml
And the PPX is generated/installed via oasis.
Anybody have any clues?
You probably created the longident wrong. You should use Longident.parse
. If that is not the case, please link to your code.
Are you aware of Tyxml and, in particular, the ppx syntax extension ?