From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: *** X-Spam-Status: No, score=3.2 required=5.0 tests=DNS_FROM_RFC_ABUSE, RCVD_IN_BL_SPAMCOP_NET,SPF_NEUTRAL autolearn=disabled version=3.1.3 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 3C803BB83 for ; Wed, 13 Sep 2006 10:10:19 +0200 (CEST) Received: from qb-out-0506.google.com (qb-out-0506.google.com [72.14.204.230]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id k8D8AIuR020154 for ; Wed, 13 Sep 2006 10:10:18 +0200 Received: by qb-out-0506.google.com with SMTP id c7so640656qbc for ; Wed, 13 Sep 2006 01:10:18 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DyWkK+FBuCm5c853dijBw85Evi0sRTxWjeHHep+qBkBHYeGgudSVBssHByxt0Zkf5cJO8VUGR/xObH0J4BElg/tBFySrbNe/DOyH/5VomJ1XBC3UksS6LwSwmz7Yb9bSM55EJznMIuwmanbKh1dGhQjvGhDrC88dToWZ/HggJPQ= Received: by 10.70.42.16 with SMTP id p16mr8222249wxp; Wed, 13 Sep 2006 01:10:17 -0700 (PDT) Received: by 10.70.84.13 with HTTP; Wed, 13 Sep 2006 01:10:17 -0700 (PDT) Message-ID: Date: Wed, 13 Sep 2006 20:10:17 +1200 From: "Jonathan Roewen" To: "Martin Hofmann" Subject: Re: [Caml-list] Modules within classes Cc: caml-list@inria.fr, Oliver.Friedmann@web.de In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-j-chkmail-Score: MSGID : 4507BCEA.001 on concorde : j-chkmail score : X : 0/20 1 X-Miltered: at concorde with ID 4507BCEA.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; mhofmann:01 struct:01 ocaml:01 pervasives:01 beginner's:01 ocaml:01 bug:01 beginners:01 unbound:01 wrote:01 oliver:01 workaround:01 compile:01 caml-list:01 caml-list:01 It's the same at normal scope: type t = 'a;; doesn't compile. you need: type 'a t = 'a, which isn't compatible with input type for Set. I think the Set module is intentionally monomorphic... Jonathan On 9/13/06, Martin Hofmann wrote: > Dear all, > > Can someone explain what is wrong here and perhaps suggest a workaround? > > class ['a] test ( l : 'a list) = > object > method result = > let module M = > struct > type t = 'a > let compare x y = > if x < y then -1 else if x > y then 1 else 0 > end > in > let module MSet = Set.Make(M) > in MSet.elements (List.fold_right MSet.add l MSet.empty) > end;; > > OCaml says: "Unbound type parameter 'a". > > Our aim is of course not to program sorting the umpteenth time but to > have a means for using Pervasives.Set within a parametrised class. > > The problem seems to be that although "class ['a]" binds 'a its use is > nevertheless disallowed in the scope of the class declaration. > > Many thanks in advance! > > Martin Hofmann (on behalf of Oliver Friedmann) > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >