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=1.1 required=5.0 tests=AWL,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 discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 1DB2DBC0A for ; Thu, 15 Mar 2007 14:25:13 +0100 (CET) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.224]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2FDPBKu015057 for ; Thu, 15 Mar 2007 14:25:12 +0100 Received: by wr-out-0506.google.com with SMTP id i31so164373wra for ; Thu, 15 Mar 2007 06:25:10 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=NUsEi5GiFzyq5lOlm60XkNPPBvU8LsQQGt7UhIrVLUtbDp8QuNArqpLub4E9rBomBXXT6HSpb3a6pSkaazD2QbqeXLOPKQ4wUmaMeOoDHa7piCoi2yEDFojENPODapqGm8aX8acv3Kgd533PQ40wGL7x/IWx1vK9ciAYDAiV9dQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=BIedKMCGu59iR63BJo0zdyKAjmkr26WsnLiFCOz7xVnJwba40TSwtHXvsKSppNclSATozNszH95ZK0itz8DJ242g++25iY327hMjwofVJtKE8THGZIlk+n3qKIEbdYJ1wYJjmjG9XXYEMT559aoSrcptCzZJ6DX0UPDpCCqoN7Y= Received: by 10.114.169.2 with SMTP id r2mr230304wae.1173965108833; Thu, 15 Mar 2007 06:25:08 -0700 (PDT) Received: by 10.114.241.6 with HTTP; Thu, 15 Mar 2007 06:25:08 -0700 (PDT) Message-ID: <875c7e070703150625r2fe44739r86755099a2bd2594@mail.gmail.com> Date: Thu, 15 Mar 2007 08:25:08 -0500 From: "Chris King" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] module types and constraints in several layers In-Reply-To: <20070315101236.GB3236@pc6197-c703.uibk.ac.at> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070315101236.GB3236@pc6197-c703.uibk.ac.at> X-j-chkmail-Score: MSGID : 45F94937.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45F94937.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; compiler:01 o'caml:01 submodules:01 submodules:01 compiler:01 struct:01 struct:01 wrote:01 signatures:01 caml-list:01 explicitly:01 modules:02 modules:02 constraints:03 types:03 On 3/15/07, Christian Sternagel wrote: > but I was not able to tell the compiler (correctly) that after > building module E ist should be the case that for example > E.E1 = D.D1 = B.B1 = A = E4.D.D1 = E4.D.D2.B1 = ... > > Is there a convenient way to make such a structure of modules? > And if yes, how ist it done? What's happening is that, when you specify the type of the results of B.Make and D.Make, O'Caml throws away the info about how they were created: since the type signatures B.T and D.T simply say "these modules have some submodules" but don't say where the submodules come from, that info becomes hidden (as it should be). However you can explicitly instruct the compiler not to hide this info: module Make (A : A.T) : B.T with module B1 = A = struct ... module B1 = A ... end This just says "give the resulting module the signature B.T, but retain the info that module B1 equals A". Similarly: module Make (B : B.T) (C : C.T) : D.T with module D1 = B.B1 and module D2 = B = struct ... module D1 = B.B1 module D2 = B module D3 = C ... end You don't need to do this with E.Make since its signature is left intact. You can do this with individual types too, see section 6.10 of the manual.