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 q33BNaXR017351 for ; Tue, 3 Apr 2012 13:23:36 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArACABTdek/UTWUIfGdsb2JhbABFhUuyIiIBAQsJCxsGI4IzFQgBATYCNAIFFgsCCwMCAQIBSw0IAQEXh3KoO26DPwGOQQaBL44fgRibRI08 X-IronPort-AV: E=Sophos;i="4.75,362,1330902000"; d="scan'208";a="138854194" Received: from mx4.wp.pl ([212.77.101.8]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Apr 2012 13:23:30 +0200 Received: (wp-smtpd smtp.wp.pl 18326 invoked from network); 3 Apr 2012 13:23:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=1024a; t=1333452209; bh=v3NLLRY6K4LEnPWNL7mdCTTz4wzb3W1WeVMPAu5D7GA=; h=From:To:Subject; b=Rr9zNXp0Ef/MoM4iNCfUhjJUv2Fo/O8voEDWJ0t9Rm0iimA5IpDjAbUAavEGuU2vx 8mPJjAHgi1JfXlbT8APN91P7iBeoyJnT7fIoSkRxN93MAsKyM4BIj9kOmyUCq4YtRm 0F39rfj+ysT16E9RjIp3Bco+MmhVimlRSuYMpgao= Received: from 88-199-36-28.tktelekom.pl (HELO [10.0.0.101]) (d0@[88.199.36.28]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with AES256-SHA encrypted SMTP for ; 3 Apr 2012 13:23:28 +0200 Message-ID: <4F7ADDAF.2030201@wp.pl> Date: Tue, 03 Apr 2012 13:23:27 +0200 From: Dawid Toton User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Caml 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 [AcO0] Subject: [Caml-list] When functor yields many types - include a module with extra type equality? Consider the following: --- a.mli module type B = sig type t end module type S = sig type t type other_lenghty_definitions val not_much_code : t end module Make (B : B) : S with type t = B.t --- --- a.ml module type B = sig type t end module type S = sig type t type other_lenghty_definitions val not_much_code : t end module Make (B : B) = struct type t = B.t type other_lenghty_definitions let not_much_code = assert false end --- So we have to keep 3 copies of other_lenghty_definitions. I can have it isolated in a separate file and insert into a.ml and a.mli in an extra preprocessing step. But I believe there should be some clean solution, something like the following: --- c_sig.ml module S = struct type t type other_lenghty_definitions end module type S = sig include (module type of S) (* 1 *) val not_much_code : t end --- --- c.mli module type B = sig type t end module Make (B : B) : C_sig.S with type t = B.t --- --- c.ml module type B = sig type t end module Make (B : B) = struct include C_sig.S with type t = B.t (* 2 *) let not_much_code = assert false end --- How to do what I mark with (* 1 *) and (* 2 *) correctly? Would it help if I upgrade my toolchain from 3.11.2 to some more recent version? Dawid