From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p2U2oG2R005141 for ; Wed, 30 Mar 2011 04:50:16 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag8BAESZkk2A1gkBe2dsb2JhbACYUI0VAQEWJgUgv2+FagSFOA X-IronPort-AV: E=Sophos;i="4.63,266,1299452400"; d="scan'208";a="91506367" Received: from courier.cs.helsinki.fi (HELO mail.cs.helsinki.fi) ([128.214.9.1]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 30 Mar 2011 04:50:10 +0200 Received: from melkinpaasi.cs.helsinki.fi (melkinpaasi.cs.helsinki.fi [128.214.9.14]) (AUTH: PLAIN cs-relay, TLS: TLSv1/SSLv3,256bits,AES256-SHA) by mail.cs.helsinki.fi with esmtp; Wed, 30 Mar 2011 05:50:09 +0300 id 0008CEF1.4D929A61.000069EF Received: by melkinpaasi.cs.helsinki.fi (Postfix, from userid 37211) id 6886D801E1; Wed, 30 Mar 2011 05:50:09 +0300 (EEST) Date: Wed, 30 Mar 2011 05:50:09 +0300 From: Lauri Alanko To: caml-list@inria.fr Message-ID: <20110330025009.GA5064@melkinpaasi.cs.helsinki.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Subject: [Caml-list] Functor applications cannot be opened I have a signature that uses types from a functor applied to a member of the signature: module type T = sig type t end module F(M : T) = struct type l = M.t list end module type S = sig module M : T val x : F(M).l end I would like to get the types in F(M) into scope to avoid putting the functor application everywhere: module type S = sig module M : T open F(M) val x : l end However, this does not work, since [open] takes only a module-path, not an extended-module-path. There are workarounds: module type S2 = sig module M : T module FM : module type of F(M) open FM val x : l end This, however, requires that an implementation of S2 contains [module FM = F(M)], and we may need to add that constraint elsewhere, too. Alternatively: module SF(M : T) = struct module FM = F(M) open FM module type S = sig val x : l end end And then use [SF(X).S] instead of [S with module M = X]. But this is ugly, and precludes use with unknown M. Is there some fundamental reason why opening of functor applications is forbidden, or is this just an oversight and I should submit a feature ticket? Lauri