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: Ian Zimmerman <itz@s...>
Subject: [Caml-list] install_printer

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

# [1; 2] ;;
- : int list = List (1, 2)

so I started to write my printer function:

let list_printer ppf l =
  pp_open_box ppf 6;	(* if break needed, indent to the paren *)
  pp_print_string ppf "List (";
  
  (* now what??? *)
  
Basically, I am looking for a hook into the toploop that I can _call_
(not modify) to make it print a value (of any type) according to its
current printers.  Is that possible?

-- 
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