From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q1MInBTV012373 for ; Wed, 22 Feb 2012 19:49:11 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Al8BAEY3RU+LEwExgGdsb2JhbAA7CYMOrzkiAQELCwsFFgUigXMBAQEEOAIGAQE3AQ8LGC5XBogXpSKEKgGOYAeJX4MlAQILBAUKAwoDAg8TAgUDAoUeAoM5Y6gq X-IronPort-AV: E=Sophos;i="4.73,465,1325458800"; d="scan'208";a="145492068" Received: from hera.mpi-sb.mpg.de ([139.19.1.49]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 22 Feb 2012 19:49:06 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mpi-sb.mpg.de; s=mail200803; h=From:To:In-Reply-To:Subject: References:Message-Id:Content-Type:Content-Transfer-Encoding: Mime-Version:Date:Cc; bh=rvsXUPV2Efttfp0Bdz71ztF0TJboIfo5gXdc6yP Z7Do=; b=netUixD0+bbD84jfmVRpleNnRiscCIE0ltjHr/yWwpLWTw+Y2apl8Sd 5OVQ61ueeACBOzBA2jXumlGFAC6AfwgQ62awUo9x0Ee9T3FkUC3EQjdC0mV108RW rsfTYT2GtiQq5BTDzqSRj7BPz88jv7RD7/xj/N+QETMpm1+iE75I= Received: from srv-00-126.mpi-klsb.mpg.de ([139.19.1.29]:36230 helo=newzak.mpi-klsb.mpg.de) by hera.mpi-sb.mpg.de (envelope-from ) with esmtp (Exim 4.69) id 1S0HFP-0000Te-0Q; Wed, 22 Feb 2012 19:49:05 +0100 Received: from mnch-4d042396.pool.mediaways.net ([77.4.35.150]:62579 helo=[192.168.178.31]) by newzak.mpi-klsb.mpg.de (envelope-from ) with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) id 1S0HFO-0001bo-Hy; Wed, 22 Feb 2012 19:49:02 +0100 From: Andreas Rossberg To: Gabriel Scherer In-Reply-To: References: Message-Id: <5C609F89-8739-4280-A6D9-3F78C451E0C1@mpi-sws.org> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Date: Wed, 22 Feb 2012 19:49:01 +0100 Cc: caml List X-Mailer: Apple Mail (2.936) Subject: Re: [Caml-list] Re: "module type of" on sub-module of functor result On Feb 22, 2012, at 18.24 h, Gabriel Scherer wrote: >> [A(B)] and [A.B] are syntacticly valid module_expr's but >> [A(B).C] isn't. Is this because of an inherent limitation in the >> module system? > > I believe so. When you apply a functor, you may get fresh types as a > result -- the generative (abstract, algebraic) types of the functor > image. If you write `module M = A(B)`, the fresh types have a clear > identity: M.t, M.q etc; similarly if you pass A(B) to a functor with > formal parameter X, it is X.t, X.q etc. But if you write `module M = > A(B).C`, there is no syntactic way to name the fresh types generated > by the functor application; in particular, naming them A(B).t would be > incorrect -- because you could mix types of different applications. > > For example, what would be the signature of A(B).C with: > > module B = struct end > module A(X : sig end) = struct > type t > module C = struct type q = t end > end > > ? Are you perhaps thinking of SML-style generative functors here? Because with Ocaml's applicative functors F(A) in fact always returns the same abstract types, and you _can_ actually refer to types via the notation F(A).t ;-) /Andreas