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 392A6BCAB for ; Thu, 2 Jun 2005 13:15:25 +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 j52BFOAk026677 for ; Thu, 2 Jun 2005 13:15:24 +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 NAA16660 for ; Thu, 2 Jun 2005 13:15:24 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j52BFMnn026670 for ; Thu, 2 Jun 2005 13:15:23 +0200 Received: from localhost (milk [130.54.16.52]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id j52BFHnr002504; Thu, 2 Jun 2005 20:15:20 +0900 (JST) Date: Thu, 02 Jun 2005 20:15:17 +0900 (JST) Message-Id: <20050602.201517.68552080.keiko@kurims.kyoto-u.ac.jp> To: Julien.Signoles@lri.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] a module with multiple signatures From: Keiko Nakata In-Reply-To: References: <20050602.161836.68553253.keiko@kurims.kyoto-u.ac.jp> X-Mailer: Mew version 4.2 on Emacs 20.7 / Mule 4.1 (AOI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 429EEA4C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 429EEA4A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 struct:01 struct:01 val:01 hmmm:01 ocaml:01 syntax:01 val:01 sig:01 sig:01 defines:01 constructors:01 constructors:01 ...:98 ....:98 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: > Because only M.T1 exists, not M1.T1. You can see this on a simpler > example: > > module X = struct type t = T end > module Y = struct type t = X.t end > let f x = match x with Y.T -> () > (* type error : "Unbound constructor Y.T" *) > let f (x:Y.t) = match x with X.t -> () > (* val f : Y.t -> unit *) Hmmm, I see ... > But, in ocaml, it possible to export the constructor T in Y by using the > following syntax: > > module X = struct type t = T end > module Y = struct type t = X.t = T (* T is egal to X.t *) end > let f x = match x with Y.T -> () > (* val f : Y.t -> unit *) > You can use signature constraints: > > module M = struct type s = S type t = T1 | T2 end > module M1 : sig type t = M.t end = M > module M2 : sig type s = M.s type t = M.t end = M This means that if I want to export T1 and T2 then I have to write as module M1 : sig type t = M.t = T1 | T2 end = M Is it correct? In my situation, M defines many types and many type constructors, and I want to give M different signatures, each of which will export different sets of type constructors. Then, it seems that I have to write the same type constructor declarations a number of times.... Isn't it avoidable? Best regards, NAKATA keiko.