From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 1D912BCAB for ; Thu, 2 Jun 2005 10:04:09 +0200 (CEST) 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 j52848La004417 for ; Thu, 2 Jun 2005 10:04:08 +0200 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 KAA14140 for ; Thu, 2 Jun 2005 10:04:08 +0200 (MET DST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j528479R004414 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Thu, 2 Jun 2005 10:04:08 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id CB0D419E705; Thu, 2 Jun 2005 10:04:07 +0200 (CEST) Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02499-04; Thu, 2 Jun 2005 10:04:07 +0200 (CEST) Received: from smtp.lri.fr (serveur3-5 [129.175.3.5]) by ext.lri.fr (Postfix) with ESMTP id B8A0319E6EA; Thu, 2 Jun 2005 10:04:07 +0200 (CEST) Received: from pc9-152 (pc9-152 [129.175.9.152]) by smtp.lri.fr (Postfix) with ESMTP id 6E54BCED9C; Thu, 2 Jun 2005 10:04:07 +0200 (CEST) Received: from filliatr by pc9-152 with local (Exim 3.36 #1 (Debian)) id 1DdkgR-000391-00; Thu, 02 Jun 2005 10:04:07 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17054.48503.615769.712007@gargle.gargle.HOWL> Date: Thu, 2 Jun 2005 10:04:07 +0200 To: Keiko Nakata Cc: caml-list@inria.fr Subject: Re: [Caml-list] a module with multiple signatures In-Reply-To: <20050602.161836.68553253.keiko@kurims.kyoto-u.ac.jp> References: <20050602.161836.68553253.keiko@kurims.kyoto-u.ac.jp> X-Mailer: VM 7.18 under Emacs 21.3.1 From: Jean-Christophe Filliatre X-Virus-Scanned: by amavisd-new at lri.fr X-Miltered: at nez-perce with ID 429EBD78.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 429EBD77.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 filliatre:01 filliatre:01 lri:01 functors:01 avoiding:01 struct:01 sig:01 ocaml's:01 ...:98 ...:98 writes:01 abstract:01 signatures:01 signatures:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: Keiko Nakata writes: > > I tried to give a module different signatures through an use of functors. > Then I faced a situation for which I do not understand the reason. > > This is the simplified version of my situation. > [...] > Anyway, > there may be a nicer way to give a module multiple signatures > while avoiding duplicate type declarations as possible? > (In the above setting, I want to make the type s in M abstract in some > context, but transparent in another context.) I think you can proceed as follows: module M = struct type s type t = A | B end module M1 : sig type t = M.t = A | B end = M module M2 : ... = M i.e. you cannot put only "t = M.t" in the signature of M1, you need to add "= A|B". This is called a "re-exported variant type" in Ocaml's manual (see http://caml.inria.fr/pub/docs/manual-ocaml/manual018.html) -- Jean-Christophe