From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 0C356BBAF for ; Sat, 24 Apr 2010 01:14:48 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvgBABPH0UvUTWUIkGdsb2JhbACDFZkaFQEBAQEJCQwHEQQerCSRNYEmgnhtBA X-IronPort-AV: E=Sophos;i="4.52,264,1270418400"; d="scan'208";a="49463989" Received: from mx4.wp.pl ([212.77.101.8]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/EDH-RSA-DES-CBC3-SHA; 24 Apr 2010 01:14:47 +0200 Received: (wp-smtpd smtp.wp.pl 19971 invoked from network); 24 Apr 2010 01:14:46 +0200 Received: from 18-161.2-0.pl (HELO [192.168.1.101]) (d0@[91.189.18.161]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with RC4-MD5 encrypted SMTP for ; 24 Apr 2010 01:14:46 +0200 Message-ID: <4BD229E4.4050003@wp.pl> Date: Sat, 24 Apr 2010 01:14:44 +0200 From: Dawid Toton User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100415 Thunderbird/3.0.4 MIME-Version: 1.0 To: caml-list Subject: Module type of a structure returned by functor Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-WP-AV: skaner antywirusowy poczty Wirtualnej Polski S. A. X-WP-SPAM: NO 0000000 [AQNE] X-Spam: no; 0.00; functor:01 functor:01 sig:01 sig:01 val:01 foo:01 struct:01 foo:01 struct:01 int:01 algorithm:01 constructs:02 theoretical:03 canonical:03 module:03 1. The following piece of code contains illegal constructs. These are functor applications marked with (* ? *). Basically, I need module type of what is produced by functor. My first question is: what is the proper, "canonical" workaround for unavailability of applications marked (* ? *) ? module type Big = sig type t type u end module type Small = sig type t end module type MakeEdge = functor (Big : Big) -> sig val foo : Big.t option end module MakeEdge = functor (Big : Big) -> struct let foo = None end module type Add_boilerplate = functor (Small:Small) -> sig type t end module Add_boilerplate = functor (Small:Small) -> struct type t = Small.t type u = t end module type ConvenientEdge = functor (Small:Small) -> MakeEdge (Add_boilerplate (Small)) (* ? *) module ConvenientEdge = functor (Small:Small) -> MakeEdge (Add_boilerplate (Small)) module SmallX = struct type t = int end module EdgeX = ConvenientEdge (SmallX) module type EdgeX = ConvenientEdge (SmallX) (* ? *) module Algorithm = functor (EdgeX : EdgeX) -> struct let doit = EdgeX.foo end 2. And the related question: why one can't do functor applications in module types as in above lines marked with (* ? *) ? Is there some theoretical reason? 3. Will the "module type of..." feature of 3.12 help with this? I can imagine e.g.: module type EdgeX = (module type of (ConvenientEdge (SmallX))) Dawid