Generalized polymorphic #install_printer #5958
Original bug ID: 5958
It would be nice to have the toplevel #install_printer recognizing polymorphic printing functions of the following form:
(Formatter.t -> 'a -> unit) -> (Formatter.t -> 'a t -> unit)
(... and so forth for any number of parameters)
The additional function arguments would be the current printer specialized at their respective type arguments.
This would permit to reuse the current printer for polymorphic data structures. I think it is possible to do so hacking the compiler-libs, but I did not manage to figure how to do it properly. So having it built-in would be more user-friendly, in particular for the debugger.
Comment author: hnrgrgr
The attached patches are work in progress and need to be tested and improved.
The first patch allows the generic printer (in 'genprintval') to be extended with parameterised printers. The second one extends the #install_printer directive accordingly.