From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 9AC01BBAF for ; Mon, 3 Jul 2006 16:51:01 +0200 (CEST) Received: from bonito.ulb.ac.be (bonito.ulb.ac.be [164.15.59.220]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k63Ep2HK019486 for ; Mon, 3 Jul 2006 16:51:02 +0200 Received: from mach.vub.ac.be (maxi.ulb.ac.be [164.15.128.8]) by bonito.ulb.ac.be (Postfix) with ESMTP id 2838EEE for ; Mon, 3 Jul 2006 16:50:59 +0200 (CEST) Received: by mach.vub.ac.be (Postfix, from userid 21099) id F3A2F8D13; Mon, 3 Jul 2006 16:50:58 +0200 (CEST) Received: from mail.etro.vub.ac.be (etro1.vub.ac.be [134.184.2.1]) by mach.vub.ac.be (Postfix) with ESMTP id 145DE8D0E for ; Mon, 3 Jul 2006 16:50:58 +0200 (CEST) Received: from [10.0.4.37] (helo=ssel.vub.ac.be) by smtp.etro.vub.ac.be with esmtp (Exim 4.43) id 1FxPlJ-00033l-U6 for caml-list@yquem.inria.fr; Mon, 03 Jul 2006 16:50:57 +0200 Received: from localhost (localhost.localdomain [127.0.0.1]) by ssel.vub.ac.be (Postfix) with ESMTP id D79752468865 for ; Mon, 3 Jul 2006 16:50:57 +0200 (CEST) X-Virus-Scanned: amavisd-new at example.com Received: from ssel.vub.ac.be ([127.0.0.1]) by localhost (ssel.vub.ac.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oQZrgTAyIgZv for ; Mon, 3 Jul 2006 16:50:56 +0200 (CEST) Received: from [10.0.4.145] (unknown [10.0.4.145]) by ssel.vub.ac.be (Postfix) with ESMTP id 619CA2468861 for ; Mon, 3 Jul 2006 16:50:56 +0200 (CEST) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <20060703155131.7031cffa@is003364.intra.cea.fr> References: <069A1F65-E50C-4363-9CCA-C6CC9A453D09@vub.ac.be> <20060703155131.7031cffa@is003364.intra.cea.fr> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <5E0B2C43-5EDD-423F-B2ED-8BC025596DC7@vub.ac.be> Content-Transfer-Encoding: 7bit From: Bruno De Fraine Subject: Re: [Caml-list] Type from local module would escape its scope? Date: Mon, 3 Jul 2006 16:50:54 +0200 To: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.752.2) X-Miltered: at concorde with ID 44A92ED6.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; iirc:01 forall:01 iter:01 foo:01 endline:01 iter:01 stringset:01 struct:01 stringset:01 wrote:01 caml-list:01 argument:01 string:02 string:02 types:02 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 On 03 Jul 2006, at 15:51, Virgile Prevosto wrote: > IIRC arguments can not have a generalized type of the form > "forall 'a, 'a -> unit", but methods and record fields support such > types: for instance, you can have: Thanks for your explanations! To get closer to the problem that caused me to investigate the error: so there is no way to make f1 into an argument in the following function iter_uniques (other than as a method or record field)? let f1 add empty = List.fold_right add ["foo"; "bar"; "bar"] empty ;; let f2 = print_endline ;; let iter_uniques comparison_fun = let module StringSet = Set.Make(struct type t = string let compare = comparison_fun end) in StringSet.iter f2 (f1 StringSet.add StringSet.empty) ;; Because in case I didn't require a dynamic comparison function, I would simply write: module StringSet = Set.Make(String) ;; let iter_uniques f1 f2 = StringSet.iter f2 (f1 StringSet.add StringSet.empty) ;; Regards, Bruno