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 087867FCCB for ; Tue, 14 Apr 2015 14:12:48 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of goswin-v-b@web.de) identity=pra; client-ip=212.227.15.3; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of goswin-v-b@web.de designates 212.227.15.3 as permitted sender) identity=mailfrom; client-ip=212.227.15.3; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="goswin-v-b@web.de"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.web.de) identity=helo; client-ip=212.227.15.3; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="goswin-v-b@web.de"; x-sender="postmaster@mout.web.de"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AyAQBTAy1VnAMP49Rc0XACgT48EAEBAQEBAQERAQEBAQEGDQkJFC6EIAEBBDIBVgsYCSUPBSiISQEYxRYfhXcBCyCLK4UDFoMBgRYBBJsehwoMjVeCJB2BUoMwAQEB X-IPAS-Result: A0AyAQBTAy1VnAMP49Rc0XACgT48EAEBAQEBAQERAQEBAQEGDQkJFC6EIAEBBDIBVgsYCSUPBSiISQEYxRYfhXcBCyCLK4UDFoMBgRYBBJsehwoMjVeCJB2BUoMwAQEB X-IronPort-AV: E=Sophos;i="5.11,576,1422918000"; d="scan'208";a="111013960" Received: from mout.web.de ([212.227.15.3]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Apr 2015 14:12:47 +0200 Received: from frosties.localnet ([95.208.221.151]) by smtp.web.de (mrweb002) with ESMTPSA (Nemesis) id 0Lxx4O-1ZTXsA2oLc-015K33 for ; Tue, 14 Apr 2015 14:12:46 +0200 Received: from mrvn by frosties.localnet with local (Exim 4.84) (envelope-from ) id 1Yhzht-0004dU-KT for caml-list@inria.fr; Tue, 14 Apr 2015 14:12:45 +0200 Date: Tue, 14 Apr 2015 14:12:45 +0200 From: Goswin von Brederlow To: caml-list@inria.fr Message-ID: <20150414121245.GA16590@frosties> References: <20150209142107.GA24464@pl-59055.rocqadm.inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20150209142107.GA24464@pl-59055.rocqadm.inria.fr> User-Agent: Mutt/1.5.23 (2014-03-12) X-Provags-ID: V03:K0:bRO+oIVebP7FkY2sYenrgicqOYbJaqz8CF6QKoPVf1ck9AtEtmG fYuxpVsyx6jmuLLGknb/jLJFtlMJTSXETT8+Y9hMOfyh0Y7JPCWYD0WOERcjdvG2RWnTEoO RZ1ZHY/mn7psZYuGD3Xfe/oTjNefXHrmBFWmM3DrgQvS4IefPQ1/nURw7TazCytFnWiFGhR U83gxwTTJsnWBcveAQgvg== X-UI-Out-Filterresults: notjunk:1; Subject: Re: [Caml-list] Polymorphic hash tables On Mon, Feb 09, 2015 at 03:21:07PM +0100, Sébastien Hinderer wrote: > 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. You have to use a functor there. MfG Goswin