Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] install_printer
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] install_printer
Hi,

On Thu, Jan 24, 2002 at 07:56:58PM -0800, Ian Zimmerman wrote:

> Hi, I can hook into the toplevel loop to modify printing of simple
> types like int with #install_printer, but what about polymorphic
> types?

For a general printing of all values of all types, use the hook
Toploop.print_out_value. You can change it to point to your function.

This function must take a value of type Outcometree.out_value and
print it. The module Outcometree is in the installed OCaml library
directory.

The default value of !Toploop.print_out_value is the function "print_outval"
located in the OCaml sources file toplevel/genprintval.ml. You can make your
own version by copying this function and adapt it for your own usage.

Another example is the "revised syntax" of Camlp4 in the OCaml
sources, file "camlp4/top/rprint.ml". (use "camlp4r pr_o.cmo
camlp4/top/rprint.ml" to see this file in normal syntax, if you
prefer).

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
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