# \[ANN\] Genprint v0.4

**URL:** <https://discuss.ocaml.org/t/ann-genprint-v0-4/5575>\
**Category:** Community\
**Created:** [April 20, 2020, 11:10pm UTC](https://discuss.ocaml.org/t/ann-genprint-v0-4/5575 "2020-04-20T23:10:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![progman](https://avatars.discourse-cdn.com/v4/letter/p/8797f3/32.png) [@progman](https://discuss.ocaml.org/u/progman)\
**Post date:** [April 20, 2020, 11:10pm UTC](https://discuss.ocaml.org/t/ann-genprint-v0-4/5575/1 "2020-04-20T23:10:17Z")

</div>

A re-announcement of Genprint, a general value printing library, a new release that addresses prior limitations that made it none too useful!

1. It didn’t work correctly for 4.08.0, the latest compiler release as of first announcement (though fine for 4.02 … 4.07.1)
2. There was an awkward need to specify a search path for .cmt files when working with the likes of Dune (which uses separate directories for source, .cmi and (for opt) .cmt files)
3. More often than not values of interest would display simply as `<abstr>` owing to the presence of signature abstraction of the module’s type of interest.

These issues have been addressed:

1. Works with versions 4.04 … 4.10.0 (earlier versions became invalid after a dependency change to ppxlib)
2. The location of .cmt files is captured automatically by the PPX preprocessor.
3. Signatures at the implementation level (.mli files) and internally (functor application constraints) are removed to reveal the inner structure of otherwise abstract values.  
For instance, the Ephemeron module:

```auto
module EM=Ephemeron.K1.Make(struct type t=int let equal=(=) let hash=Hashtbl.hash end)
open EM
let _=
  let v=EM.create 0 in
  EM.add v 12345678 'X';
  let emprint ppf (v: Obj.Ephemeron.t) =
    Format.fprintf ppf "<C wrapper of key/data>" in
  [%install_printer emprint];
  [%pr ephem v];

```

Which prints:

```auto
ephem => {size = 1;
          data =
           [|Empty; Empty; Empty; Empty; Empty; Empty; Empty; Empty; Empty;
             Empty; Empty; Cons (922381915, <C wrapper of key/data>, Empty);
             Empty; Empty; Empty; Empty|];
          seed = 0; initial_size = 16}

```

This also demos the [%install\_printer] facility which mirrors the REPL’s.

Installation is via the Opam main repository.

Additionally, the project repository [contains](https://github.com/progman1/genprintlib/tree/master/debugger) two compiler versions of **ocamldebug** integrated with the Genprint library which thereby becomes its default printer.

All of which makes this library much more useful than previously.  
See the [project page](https://github.com/progman1/genprintlib) for the details.
