OCaml hash-consing library
The technique is described in this paper:
Sylvain Conchon and Jean-Christophe Filliâtre. Type-Safe Modular Hash-Consing. In ACM SIGPLAN Workshop on ML, Portland, Oregon, September 2006.
Note: a different, more elaborated hash-consing library can be found in Why3 sources at https://gitlab.inria.fr/why3/why3