`Format`-based `ppx_deriving.show` syntax

Continuing the discussion from Printf @@deriving sexp:

Is there a variant of [%show: core type] that is a pp printer rather than generating a string?

No, though [%pp: ...] would be a great addition to ppx-deriving.

1 Like

It would be a great, great thing to have. The problem I see, is that somebody needs to define the target format. Actually implementing a target format, once defined, would be child’s play. And given the history of people wanting to customize their ocamlformat output (which is entirely laudable), probably there need to be a bunch of knobs to turn. This is all straightforward, if only somebody wants to take on the “herding cats” part of the challenge and define this format.

I hope I’m making sense here when I say “target format”: what I mean is, where should the boxes go, the indents, how much indentation, etc.
Oh ha! I forgot that deriving.show already does this.

ppx_deriving already derives pp functions for type definitions, just not in that inline form. The point was that for show functions it does both.
So the “target format” is already in there and just needs to be exposed in the inline form.

Oy, I forgot! Indeed it does!