Version française
Home     About     Download     Resources     Contact us    
Browse thread
Defining own types printers.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: michel@l...
Subject: Defining own types printers.
Hi,

I have some user-defined types , and I'd like to have them printed the
ritgh way under caml-ligth when I just want to see the contents of a var ->

Ex:
---
#x1;;
- : t_bdd_tree = cNode {label="x1"; alors=cNode {label="x2"; alors=cNode {label="x3"; alors=cTerm false; sinon=cTerm false}; sinon=cNode {label="x3"; alors=cTerm
 false; sinon=cTerm true}}; sinon=cNode {label="x2"; alors=cNode {label="x3"; alors=cTerm false; sinon=cTerm true}; sinon=cNode {label="x3"; alors=cTerm false; s
inon=cTerm true}}}
#

I'd like to see ->

#print_bdd x1;;
(x1, (x2, (x3, 0, 0), (x3, 0, 1)), (x2, (x3, 0, 1), (x3, 0, 1)))- : unit = ()

I see at the page #231 of the Caml-light ref manual, that the chapter
will deal with Streams, parsers and printers but there's nothing
concerning user-defined printers (like in CAML).

My question is : Is it possible to attach printers to user defined
types ?

BTW, I wrote in english, since there might be some non-french readers
reading this question.

Thank you in advance.
-- 
  Olivier MICHEL                           Email : michel@lri.lri.fr 
  Laboratoire LRI - Universite PARIS_SUD         : michel@FRLRI61.BITNET
  Bat. 490- bureau 69                      Fax   : 33-1-64-46-19-92
  91405 ORSAY CEDEX                        Phone : 33-1-69-41-65-79
  FRANCE                                   

"if you're not programming functionally, then you must be programming
dysfunctionally"