Polymorphic hash operates without type information, so it's not able to tell that it's hashing your record type vs. some other type with the same structure. So I would guess that what you want is not possible. The Core team is working on a ppx extension analogous to ppx_sexp_conv and ppx_compare which generates hash functions automatically, and would make this kind of thing possible, but it's not done yet. On 13 May 2016 at 15:52, Soegtrop, Michael wrote: > Dear Ocaml Users, > > > > I wonder if there is a way to specify a default hash function for a type, > which is then used by the automated hash functions e.g. created for records > containing this type. I have e.g. a record with about 10 fields and I am > happy with the default hash functions for most fields and for the record, > but for just one field I would like to use a custom hash function, but I > don’t want to write a hash function for the record. > > > > I am currently using the standard library, but if there is a solution with > Batteries or Core, I would also be interested. > > > > Best regards, > > > > Michael > > Intel Deutschland GmbH > Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany > Tel: +49 89 99 8853-0, www.intel.de > Managing Directors: Christin Eisenschmid, Christian Lamprechter > Chairperson of the Supervisory Board: Nicole Lau > Registered Office: Munich > Commercial Register: Amtsgericht Muenchen HRB 186928 >