From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA28097 for caml-redistribution; Fri, 11 Apr 1997 11:17:16 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA26233 for ; Fri, 11 Apr 1997 10:09:44 +0200 (MET DST) Received: from arthur.u-strasbg.fr (boos@arthur.u-strasbg.fr [130.79.6.103]) by nez-perce.inria.fr (8.7.6/8.7.3) with ESMTP id KAA22720 for ; Fri, 11 Apr 1997 10:09:43 +0200 (MET DST) Received: (from boos@localhost) by arthur.u-strasbg.fr (8.7.5/8.7.3) id KAA04329; Fri, 11 Apr 1997 10:05:21 +0200 Date: Fri, 11 Apr 1997 10:05:21 +0200 Message-Id: <199704110805.KAA04329@arthur.u-strasbg.fr> From: Christian Boos MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: caml-list@inria.fr CC: Basile.Starynkevitch@cea.fr, Mark Hayden Subject: Re: Q: hashtables of parametrized types in Ocaml? In-Reply-To: <199704041903.OAA17096@gulag.cs.cornell.edu> References: <199704041144.NAA11665@soleil.serma.cea.fr> <199704041903.OAA17096@gulag.cs.cornell.edu> X-Mailer: VM 6.22 under 19.15 XEmacs Lucid Sender: weis Mark Hayden writes: > > Here is a similar example that works for me. > This is for hash tables that use MD5 digest > strings for keys. > > --Mark > <<.mli and .ml snipped>> Hello, I don't think this was an example similar to the original post. What Basile needed was a parametrized type for the key type: He wrote: > >I tried > > > > module SymbolHashtbl = > > Hashtbl.Make(struct > > type t = 'a asymbol_t > > let equal = (==) > > let hash = symhash > > end) > > > >but it doesn't work! How can I achieve an equivalent result? Of course > > <<...>> > >Perhaps a double functor is the answer, but I can't figure it out! I think his idea of a "double functor" is the good one. Try: module MakeHashtbl (S : sig type v end) = Hashtbl.Make (struct type t = S.v asymbol_t let equal = (==) let hash = symhash end) and then later: module NodeSymbolHashtbl = MakeHashtbl (sig type v = node_t end) -- Christian