From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 8D1A87FC19 for ; Mon, 9 Feb 2015 15:19:28 +0100 (CET) X-IronPort-AV: E=Sophos;i="5.09,544,1418079600"; d="scan'208";a="99417285" Received: from hp-sebastien.rsr.lip6.fr (HELO pl-59055.rocqadm.inria.fr) ([132.227.76.32]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/AES128-SHA; 09 Feb 2015 15:19:28 +0100 Received: from shindere by pl-59055.rocqadm.inria.fr with local (Exim 4.84) (envelope-from ) id 1YKpD1-0006N5-O3 for caml-list@inria.fr; Mon, 09 Feb 2015 15:21:07 +0100 Date: Mon, 9 Feb 2015 15:21:07 +0100 From: =?utf-8?Q?S=C3=A9bastien?= Hinderer To: caml-list@inria.fr Message-ID: <20150209142107.GA24464@pl-59055.rocqadm.inria.fr> Mail-Followup-To: caml-list@inria.fr MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Subject: [Caml-list] Polymorphic hash tables Hi, Is there a way to just replace OCaml's standard hash function for some tables? Here is an example: module MyHashedType : Hashtbl.HashedType = struct type t let my_n = 20 let my_m = 30 let equal = (=) let hash = Hashtbl.hash_param my_n my_m end module MyHashtbl = Hashtbl.Make(MyHashedType) let (mytbl : int MyHashtbl.t) = MyHashtbl.create 100 With this example polymorphism seems to be lost and the compiler does not accept something like type t = 'a to retrieve a generic type as for the standard hash tables. Any suggestion? Thanks a lot. Sébastien.