From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 849A4BCAE for ; Thu, 2 Jun 2005 09:18:40 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j527IeXm022777 for ; Thu, 2 Jun 2005 09:18:40 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA14091 for ; Thu, 2 Jun 2005 09:18:39 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j527Ibpu022771 for ; Thu, 2 Jun 2005 09:18:39 +0200 Received: from localhost (yomogi [130.54.16.40]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id j527IaI2027003 for ; Thu, 2 Jun 2005 16:18:36 +0900 (JST) Date: Thu, 02 Jun 2005 16:18:36 +0900 (JST) Message-Id: <20050602.161836.68553253.keiko@kurims.kyoto-u.ac.jp> To: caml-list@inria.fr Subject: a module with multiple signatures From: Keiko Nakata 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 concorde with ID 429EB2D0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 429EB2CD.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; functors:01 struct:01 functor:01 sig:01 struct:01 functor:01 sig:01 avoiding:01 unbound:01 abstract:01 signatures:01 signatures:01 constructor:01 match:02 match:02 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: Hello, 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. module M = struct type s = S type t = T1 | T2 of s end module F1 = functor (X : sig type t end) -> struct type t = X.t end module F2 = functor (X : sig type s type t end) -> struct type s = X.s type t = X.t end module M1 = F1(M) module M2 = F2(M) let f x = match x with M1.T1 -> 1 | M1.T2 x -> 2;; (* This is not type checked *) (* I got the error "Unbound constructor M1.T1" *) (* This is type checked *) let g (x : M1.t) = match x with M.T1 -> 1 | M.T2 x -> 2;; Why M1.T1 should not be bound? 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.) Regards, NAKATA Keiko