Make generated show function ugly

I tried to use ppx-deriving and its show plugin to get easy stringification for my ADTs. But in the context of my project I want it to be easily machine readable, while it seems that show is meant for pretty-printing. For example if I have this:

type long_foo = FooooooooooLooooooooong of string
[@@deriving show]

then the result of

show_long_foo ( FooooooooooLooooooooong "LOOOOOOOOOOOOOOOOOOONGFOOOOOO" )

will be something like

(FooooooooooLooooooooong
    "LOOOOOOOOOOOOOOOOOOONGFOOOOOO")

when I really want it on the same line, with a single space in between, no matter how long that line will be. Is there a tweak I can make to the deriving annotation, or to the way I link the ppx? If there is I can’t find it in the obvious documentation places :tongue:

Thanks.

That is correct. If you want machine readability, it’d be much better to use formats and (de)serializers designed for this, e.g. JSON, S-exp, etc. There are many ppx-s for such things as well.

The show plugin also creates a more general pp function, which can be used together with the standard Format module. There it’s possible to change the margin to something very large that avoids the automatic line-breaking offered by Format: OCaml library : Format.