From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id A9275BC28 for ; Fri, 12 Nov 2004 17:40:02 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iACGe2t1024618 for ; Fri, 12 Nov 2004 17:40:02 +0100 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 RAA31829 for ; Fri, 12 Nov 2004 17:40:01 +0100 (MET) Received: from smtp.science.uva.nl (smtp.science.uva.nl [146.50.4.84]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iACGe1Cj024607 for ; Fri, 12 Nov 2004 17:40:01 +0100 Received: from mojave.science.uva.nl [146.50.1.228] by smtp.science.uva.nl with ESMTP (sendmail 8.11.6p2/config 11.35). id iACGe0L17042; Fri, 12 Nov 2004 17:40:00 +0100 Received: from localhost by mojave.science.uva.nl (sendmail 8.11.6/config 11.35). id iACGe0731978; Fri, 12 Nov 2004 17:40:00 +0100 X-Organisation: Faculty of Science, University of Amsterdam, The Netherlands X-URL: http://www.science.uva.nl/ From: Andrew Bagdanov MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16788.59232.464964.613076@mojave.science.uva.nl> Date: Fri, 12 Nov 2004 17:40:00 +0100 To: caml-list@inria.fr Subject: Re: [Caml-list] Specifying abstract type in a record In-Reply-To: <4194E0C7.4060102@trdlnk.com> References: <20041111083547.GA13116@pulp.anu.edu.au> <1100163369.2579.70.camel@pelican.wigram> <20041111090931.GA13972@pulp.anu.edu.au> <20041111104849.29e7e506@mpiat2314> <4194E0C7.4060102@trdlnk.com> X-Mailer: VM 7.07 under Emacs 21.3.1 X-Virus-Scanned: by amavisd-new X-Miltered: at nez-perce with ID 4194E762.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4194E761.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 val:01 printf:01 printf:01 val:01 ...:98 unbound:01 writes:01 polymorphic:01 abstract:01 int:01 int:01 parameter:02 parameter:02 unit:02 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: josh writes: > OK, Here's what I'm trying to do: > > # type doer = { file_name:string ; actor: ('a -> unit) };; > > But when I do this, it tells me that I've got "Unbound type parameter 'a ". > You need to add a type parameter to the doer type: # type 'a doer = {file_name:string; actor: ('a -> unit) };; type 'a doer = { file_name : string; actor : 'a -> unit; } This binds the type parameter 'a in your original definition. Now things should work the way you want: # let b = {file_name = "one"; actor = (fun x -> () ) };; val b : 'a doer = {file_name = "one"; actor = } # b.actor 10;; - : unit = () Note that in this definition, b.actor remains polymorphic. If you were to do this: # let b = {file_name = "one"; actor = (fun x -> Printf.printf "%d\n" x) };; val b : int doer = {file_name = "one"; actor = } then 'a becones concrete (int). Hope this helps... -Andy