Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Inspect and dump values on the OCaml heap
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2010-04-15 (05:42)
From: Martin Jambon <martin.jambon@e...>
Subject: Re: [Caml-list] Inspect and dump values on the OCaml heap
Kaustuv Chaudhuri wrote:
> On Wed, Apr 14, 2010 at 5:02 PM, Kaspar Rohrer <> wrote:
>> [...]
> Implementing dumpers seems like a teething procedure for
> OCaml hackers. Here's my own attempt from a couple of years ago.
> It handles cycles, renders SVGs (via Graphviz), and can accept
> data structure "descriptions" to produce better names for the
> internal nodes. It is almost 100% OCaml.
> I am convinced that such things have *no* usefulness. If you
> are trying to debug your data structure, state its global
> invariants, prove (at whatever level of formality you are most
> comfortable with) that all API functions preserve the invariants,
> and use the module system to hide functions that do not
> preserve them. You will be done faster than trying to make
> sense of graphs and your code will be better.

The only reason why I wrote Dum was to print exceptions deeper than

# exception Foo of [`Bar of string];;
exception Foo of [ `Bar of string ]

# Printexc.to_string (Foo (`Bar "abc"));;
- : string = "Foo(_)"

# Dum.to_string (Foo (`Bar "abc"));;
- : string = "((\"Foo\") (3303859 \"abc\"))"