From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA20480; Mon, 30 Jul 2001 14:42:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 OAA20471 for ; Mon, 30 Jul 2001 14:42:19 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f6UCfpb17423; Mon, 30 Jul 2001 14:41:51 +0200 (MET DST) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA20320; Mon, 30 Jul 2001 14:41:50 +0200 (MET DST) Date: Mon, 30 Jul 2001 14:41:50 +0200 From: Xavier Leroy To: Tyng-Ruey Chuang Cc: caml-list@inria.fr Subject: Re: [Caml-list] module constraints bug? Message-ID: <20010730144150.A20368@pauillac.inria.fr> References: <200107272209.GAA24340@iota.iis.sinica.edu.tw> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <200107272209.GAA24340@iota.iis.sinica.edu.tw>; from trc@iis.sinica.edu.tw on Sat, Jul 28, 2001 at 06:09:07AM +0800 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > There seems to be a bug in the way o'caml handling higher-order modules > with constrained module arguments. It's not a bug, it's the intended behavior of the "SIG with module A = M" construct. But I understand that in your particular example, this behavior is not what you want! "SIG with module A = M" means: take signature SIG and replace the entry "module A : ..." in it with "module A : ". In your example: > module ThisF: F = > struct > module A = > struct > type t = Pink | Blue > end > > module Eta = functor (X: SELF with module Self = A) -> > struct > let t2t x = match x with A.Pink -> A.Blue | A.Blue -> A.Pink > end > end the principal signature of A is sig type t = A.t = Pink | Blue end (a type t with two constructors Pink and Blue, and that is equal to A.t). Hence, SELF with module Self = A expands to sig module Self : sig type t = A.t = Pink | Blue end end instead of what you expected: sig module Self : sig type t = A.t end end and which corresponds to the non-principal signature for A sig type t = A.t end > However, if we change the module constraint to a type constraint > in the definition of Eta, as shown below in module ThatF, > [i.e. SELF with type Self.t = A.t] > then it will type-check. Yes, because "SELF with type Self.t = A.t" expands to what you expect: sig module Self : sig type t = A.t end end Hope this makes the issue a bit clearer, - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr