ocaml-bin-prot

Bin_prot contains functionality for reading and writing OCaml values in a type-safe binary protocol. These functions are extremely efficient and provide users with a convenient and safe way of performing I/O on any extensionally defined data type. This means that functions, objects, and values whose type is bound through a polymorphic record field are not supported, but everything else is.

As of now, there is no support for cyclic or shared values. Cyclic values will lead to non-termination whereas shared values, besides requiring significantly more space when encoded, may lead to a substantial increase in memory footprint when they are read back in.