This was the topic for my internship back in 2017 working on the Reason compiler–integrating ppx_show into the language. I’m glad it has finally arrived (albeit in a different form) in OCaml.
What do you mean? Pretty printers have been there since ages (the article is from 2017 but the fmt library is there since 2015) and the possibility to install pretty printers in the toplevel is earlier than that
The goal was to automatically install a to_string function for every type created, not just in the top level. In normal execution
Oh, I see. Neat!
From the title I would’ve assumed this relies on some Obj magic, nice to see it doesn’t and just shows how to use pretty printers written using Fmt in the top-level.