From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA15292; Sun, 24 Oct 2004 22:54:16 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA15408 for ; Sun, 24 Oct 2004 22:54:15 +0200 (MET DST) Received: from laurie.fmf.uni-lj.si (BSN-77-186-71.dsl.siol.net [193.77.186.71]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i9OKsDLD016322 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NO) for ; Sun, 24 Oct 2004 22:54:14 +0200 Received: from localhost ([127.0.0.1]) by laurie.fmf.uni-lj.si with esmtp (Exim 4.34) id 1CLpNU-0002zn-If; Sun, 24 Oct 2004 22:54:12 +0200 Message-ID: <417C1673.6020007@andrej.com> Date: Sun, 24 Oct 2004 22:54:11 +0200 From: Andrej Bauer User-Agent: Mozilla Thunderbird 0.8 (X11/20040918) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Christophe TROESTLER CC: "O'Caml Mailing List" Subject: Re: [Caml-list] Polymorphic pretty printing References: <4173E464.7030500@andrej.com> <20041023.000711.91476428.debian00@tiscali.be> In-Reply-To: <20041023.000711.91476428.debian00@tiscali.be> X-Enigmail-Version: 0.86.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 417C1675.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; andrej:01 bauer:01 andrej:01 bauer:01 caml-list:01 troestler:01 imagining:01 fiddle:01 formatter:01 formatter:01 helper:01 posses:99 christophe:01 ocaml:01 toplevel:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Christophe TROESTLER wrote: > >> Am I supposed to rewrite half of toplevel.ml to get this working? > > I am afraid that the awser is yes :(. Let's see why: Thanks for the hints. I'd be willing to take a shot at writing a more flexible toplevel, one that allows to install polymorphic pretty-printers in a sane way. I am imagining something like this. A pretty printer may be registered with #install_printer, as before. But we need to fiddle with the types of printers to get things working. A printer pp for type t (where t may be polymorphic) would have type pp : Format.formatter -> t -> (Format.formatter -> 'a -> unit) -> unit If you compare this with the current type, you'll notice the extra argument of type (Format.formatter -> 'a -> unit). This is a helper function which would be passed to pp by the toplevel. Then pp can use it to print out any polymorphic value. Does this sound like a sound plan? Or am I missing something? Perhaps the ocaml developers secretly posses such a toplevel already. Andrej ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners