Haskell's ghci
can print nicely any value belonging to a type that implements Show
typeclass. Is there any equivalent in OCaml that lets utop
automatically print values of user-defined types nicely? Typing x |> M.to_string
every line is quite tedious…
Print values nicely in utop
1k Views Asked by Sventimir At
1
In your module for your type
M.t
define the function:You can then install a printer for the type in
ocaml
orutop
using:See the toplevel directive section of the manual.