Depyt provides type combinators to define runtime representation for OCaml types and generic operations to manipulate values with a runtime type representation.

The type combinators supports all the usual type primitives but also compact definitions of records and variants. It also allows to define the runtime representation of recursive types.

Depyt is a modern reboot of Dyntype but using GADTs-based combinators instead of syntax-extensions. When we originally wrote Dyntype (in 2012) GADTs were not available in OCaml and camlp4 was everywhere -- this is not the case anymore. Finally, Depyt avoids some of the performance caveats present in Dyntype by avoiding allocating and converting between intermediate formats.


For instance, to define variants:



Published: 12 Jul 2017

Dependencies (7)

  1. ocplib-endian >= "0.7"
  2. jsonm
  3. result < "1.5"
  4. fmt
  5. cstruct >= "0.6.0" & < "6.1"
  6. jbuilder >= "1.0+beta10"
  7. ocaml >= "4.03.0"

Dev Dependencies (1)

  1. alcotest with-test

Used by