Syntax extensions for debugging?

There is an extension called ppx_show ( but it doesn’t seem to work with the latest ocaml. Does anyone know of helpful extensions for debugging?

For quick and dirty display of any value, batteries has a dump function.
It does not give constructor names, though, since it reconstruct structures using only the memory layout of objects (at least that’s my memory model of it).

Other than that, there are various ppx extensions like that. I’d recomand starting from ppx-deriving. You could disable the ppx for production build, if you want to print only on debug mode.

I must confess that, by syntax extensions for debugging I was hoping for more than just printers. But well, it seems that’s printf-debugging is still our state-of-the-art. :-/

I found this project!

1 Like

It might be nice to do better than printf debugging indeed :slight_smile:

Unfortunately ppx_polyprint requires a lot of patching. I got ppx_show to compile though.

1 Like