You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 5958 Reporter:@ppedrot Assigned to:@chambart Status: closed (set by @xavierleroy on 2017-02-16T14:14:08Z) Resolution: fixed Priority: normal Severity: feature Fixed in version: 4.03.0+dev / +beta1 Category: runtime system and C interface Tags: patch Related to:#6908 Monitored by:@bobzhang
Bug description
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)
(Formatter.t -> 'a -> unit) -> (Formatter.t -> 'b -> unit) -> (Formatter.t -> ('a, 'b) 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.
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.
I updated the patches for lastest trunk and added a fix to prevent adding generic printers with old-style type ('a -> unit instead of formatter -> 'a -> unit)
Original bug ID: 5958
Reporter: @ppedrot
Assigned to: @chambart
Status: closed (set by @xavierleroy on 2017-02-16T14:14:08Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 4.03.0+dev / +beta1
Category: runtime system and C interface
Tags: patch
Related to: #6908
Monitored by: @bobzhang
Bug description
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)
(Formatter.t -> 'a -> unit) -> (Formatter.t -> 'b -> unit) -> (Formatter.t -> ('a, 'b) 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.
File attachments
The text was updated successfully, but these errors were encountered: