Browse thread
[Caml-list] install_printer
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Ian Zimmerman <itz@s...> |
| Subject: | Re: [Caml-list] install_printer |
itz> Hi, I can hook into the toplevel loop to modify printing of simple itz> types like int with #install_printer, but what about polymorphic itz> types? Daniel> For a general printing of all values of all types, use the hook Daniel> Toploop.print_out_value. You can change it to point to your function. Daniel> This function must take a value of type Outcometree.out_value and Daniel> print it. The module Outcometree is in the installed OCaml library Daniel> directory. Daniel> The default value of !Toploop.print_out_value is the function "print_outval" Daniel> located in the OCaml sources file toplevel/genprintval.ml. You can make your Daniel> own version by copying this function and adapt it for your own usage. Daniel> Another example is the "revised syntax" of Camlp4 in the OCaml Daniel> sources, file "camlp4/top/rprint.ml". (use "camlp4r pr_o.cmo Daniel> camlp4/top/rprint.ml" to see this file in normal syntax, if you Daniel> prefer). Thanks. I take it that your answer is 3.04 specific; actually I am working with 3.02. I will just wait with this functionality until I upgrade. Pretty amazing that it _is_ now possible, really. :-) Maybe because you needed something like it for p4? -- Ian Zimmerman, Oakland, California, U.S.A. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 In his own soul a man bears the source from which he draws all his sorrows and his joys. Sophocles. ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr