package dum

Not available on OCaml 5.5
  1. Overview
  2. Docs
Inspect the runtime representation of arbitrary OCaml values

Install

dune-project
 Dependency

Authors

Maintainers

Sources

dum-1.0.3.tbz
sha256=645a23503fc8a315530df1b2876c2f785b12cf80f5f692a41eb36e53e2c52651
sha512=f572326af6c295b8c27a54ef6d82309a71b0e31ab5f167b75ac0193350b2f59c8a355e61e83c6ad46e5562b355115f6a116148db097c648abbdd1d3d5573935c

Description

Dum is a library for inspecting the runtime representation of arbitrary OCaml values. Shared or cyclic data are detected and labelled. This guarantees that printing would always terminate. This makes it possible to print values such as closures, objects or exceptions in depth and without risk.

Added to opam-repository:

README

Dum

Purpose

Inspecting arbitrary OCaml values for debugging or just for fun.

Cycles are detected and an additional limit on the size of the dump is set by default. It is therefore safe to use for printing out exceptions in error messages.

Closure fields and object fields are printed.

All the lazy values (forced or not) can be printed but this is optional. Some forced lazy values will always be printed no matter what.

Installation

$ opam update
$ opam install dum

Usage

We do not recommend the use of this library in production code due to its reliance on OCaml internals and unsafe memory access.

$ utop -require dum
# Dum.to_stdout (123, "abc", Not_found, [`A; `B 'x']);;
(123 "abc" object-7 () [ 65 (66 120) ])

A circular list is printed as follows:

# let rec cyc = 1 :: 2 :: 3 :: cyc;;
val cyc : int list = [1; 2; 3; <cycle>]

utop # Dum.to_stdout cyc;;
#0: (1 (2 (3 #0)))

First-class modules can be inspected as well. Here's what I get for the Sys module:

# module type Sys = module type of Sys;;
# Dum.to_stdout (module Sys : Sys);;
(
  ("/home/martin/.opam/4.05.0/bin/utop" "-require" "dum")
  "/home/martin/.opam/4.05.0/bin/utop"
  closure ()
  (1)
  "Unix"
  1
  1
  0
  0
  64
  63
  0
  144115188075855863
  18014398509481983
  #0: closure ()
  -1
  -2
  -3
  -4
  -5
  -6
  -7
  -8
  -9
  -10
  -11
  -12
  -13
  -14
  -15
  -16
  -17
  -18
  -19
  -20
  -21
  -22
  -23
  -24
  -25
  -26
  -27
  -28
  #1: object1 ()
  closure (#0 -6 #1)
  "4.05.0"
  closure ()
  closure ()
)

See dum.mli for more information.

License

GNU LGPL with exception on static linking, see file LICENSE.

Dependencies (3)

  1. easy-format
  2. dune >= "2.0"
  3. ocaml < "5.0.0"

Dev Dependencies

None

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building dum with each compiler on check.ci.ocaml.org, run of against opam-repository 8a77e58. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
1.0.3 (this version) good good n/a n/a n/a
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure