-
Notifications
You must be signed in to change notification settings - Fork 71
Open
Description
Suppose I have a datatype for expressions such as
type exp =
| Num of int
| Plus of exp * exp
| Times of exp * exp
I would like to display these trees using an infix notation, so I can define a custom pretty-printer for them. Is there a way to register printers with learn-ocaml so that the datatype is printed according to the custom printer in the toplevel as well as when the automatic grader shows computing ...
in the report?
Edit: upon further investigation, the pretty-printing routine in the test_lib.ml
ultimately calls out to Toploop.print_value
, which I believe will use printers registered through Toploop.install_printer
. So if Toploop
is exposed to test.ml
, it should be possible to install custom printers.