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=0.3 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 55C49BC0A for ; Tue, 15 May 2007 19:11:30 +0200 (CEST) Received: from smtp5-g19.free.fr (smtp5-g19.free.fr [212.27.42.35]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4FHBTwW007116 for ; Tue, 15 May 2007 19:11:30 +0200 Received: from [192.168.1.111] (vil93-4-82-227-140-227.fbx.proxad.net [82.227.140.227]) by smtp5-g19.free.fr (Postfix) with ESMTP id CA46543F22; Tue, 15 May 2007 19:11:29 +0200 (CEST) Message-ID: <4649E9C1.4040404@philippewang.info> Date: Tue, 15 May 2007 19:11:29 +0200 From: Philippe Wang User-Agent: Thunderbird 1.5.0.10 (Macintosh/20070221) MIME-Version: 1.0 To: Josh Berdine , ocaml ml Subject: Re: [Caml-list] type aliases and recursive modules References: <02bd01c79707$7b9d4c60$72d7e520$@qmul.ac.uk> <4649DFDD.6040409@philippewang.info> <02d701c79712$0fbb09f0$2f311dd0$@qmul.ac.uk> In-Reply-To: <02d701c79712$0fbb09f0$2f311dd0$@qmul.ac.uk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 4649E9C2.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; recursive:01 sig:01 val:01 val:01 struct:01 sig:01 struct:01 cheers:01 cheers:01 wrote:01 rec:01 constructor:01 caml-list:01 int:01 modules:02 Josh Berdine wrote: > > Thanks Philippe and Christopher, yes, mea culpa, I forgot, e.g., a > call to choose. But my confusion remains: > > > > # > > module rec A : sig > > type t = It of ASet.t > > val compare : t -> t -> int > > val get : t -> ASet.t > > end = struct > > type t = It of ASet.t > > let compare = compare > > let get = function It(x) -> x > > end > > > > and ASet : sig > > type t > > val get_its_elements : t -> A.t list > > end = struct > > module C = Set.Make(A) > > type t = C.t > > let get_its_elements x = C.elements (A.get (C.choose x)) > > end > > ;; > > Characters 350-370: > > let get_its_elements x = C.elements (A.get (C.choose x)) > > ^^^^^^^^^^^^^^^^^^^^ > > This expression has type ASet.t but is here used with type > > C.t = Set.Make(A).t > > # > > > > > > Am I still doing something stupid? > > > > Cheers, Josh > Hi, Your A.get function takes something of the form "It of something", which is of type A.t = It of ASet.t. There is no such a constructor (It) in, let get_its_elements x = C.elements (A.get (C.choose x)) So it can't go right when you call A.get... ;-) Cheers, -- Philippe Wang mail@philippewang.info