[ANN] Genprint - general value printing

This is a patch/switch for basic printing of any value (excepting abstract and polymorphic elements) exactly as printed by the toplevel for a final result.

It’s appropriate for debug purposes where custom crafted or ppx-deriving printers are overkill/inconvenient.


This is a damn useful thing. Often when debugging I just want a quick and dirty way to view the content of a variable and I don’t want to build infrastructure to do it because my only use case is debugging or test case exercises.

I wish something like this was in the mainline of the compiler.

1 Like

Is there any chance of submitting this to the opam repository btw?

as a switch?

Sure, or in whatever other form allows people with OPAM installed to simply get it running at will. Since compiler plugins are obsolete, I imagine a switch is the best option.

I’m not sure what to provide -
if it it might be used for more than testing then perhaps
it shouldn’t have both patches present.
the non-toplevel specific patch would serve for top/byte/opt.

absent any further feedback, I’ll go with that.

Perhaps someone else has experience and might be able to offer a suggestion. I’ve never tried building an opam file for an OCaml variant using an external patch…

that wasn’t the issue. Are you aware I mentioned this as already being available on a switch? As it’s in a personal repo there is one extra command to get it installed, listed on the project page.