From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTP id 8FA8A5D4 for ; Fri, 11 Oct 2019 15:24:48 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.67,284,1566856800"; d="scan'208";a="405803315" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 11 Oct 2019 17:24:47 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 7EE187F2F5; Fri, 11 Oct 2019 17:24:47 +0200 (CEST) Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 197907F214 for ; Fri, 11 Oct 2019 17:24:37 +0200 (CEST) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=vadim@radovel.ru; spf=Pass smtp.mailfrom=vadim@radovel.ru; spf=None smtp.helo=postmaster@forward103j.mail.yandex.net IronPort-PHdr: =?us-ascii?q?9a23=3As9WiBRABeQrb+Q7wonFIUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSPv4ocbcNUDSrc9gkEXOFd2Cra4d0KyI7uuwCSQp2tWoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7?= =?us-ascii?q?Ovr6GpLIj8Swyuu+54Dfbx9HiTagb75+NhS7oAXeusQVgoZpN7o8xAbOrnZUYe?= =?us-ascii?q?pd2HlmJUiUnxby58ew+IBs/iFNsP8/9MBOTLv3cb0gQbNXEDopPWY15Nb2tRbY?= =?us-ascii?q?VguA+mEcUmQNnRVWBQXO8Qz3UY3wsiv+sep9xTWaMMjrRr06RTiu86FmQwLuhS?= =?us-ascii?q?waNTA27XvXh9RugqxbvRyvpBJxzIDbb46JO/RzZb/dcNAASGZdQspcWS5MD4Wh?= =?us-ascii?q?ZIUPFeoBOuNYopHyqFQUsBS+BAysD/7oxz9WnHD5wKw60+E6HAHcxgMvAtUOsG?= =?us-ascii?q?rKo9XxLqsSS/21wbDOwD7ebP1WwS/w5YjSfh0uofyAR698fM7SxEU1CQ/IgVSd?= =?us-ascii?q?pZT7MzyPyugBrW2W4ut7Wu+sjmMotx19rzuqy8g3l4bEhZwax1XY+Sh8wYs4Ks?= =?us-ascii?q?G0RUt6bNOgEZZduCSXOotqTcw+X25lvjsxxKcctp6hZicKzYwqxx7BZPyDdIiF?= =?us-ascii?q?+hzjVOGLITZ2nn1lYq+wiwuu/UWuyO3wTMy030xLripBiNXNtmoC1xrO5ceZRf?= =?us-ascii?q?px5EGh1iiT1wzL6+FEJ147lbbDJpMh2LI9mZoevV7eEiLym0j6lrGae0ol9+Sw?= =?us-ascii?q?7uToeLTmppuSN49ujQH+N7wjmtKlDuslMwgOWnOW+f6m27L++k35XqtFjvksnq?= =?us-ascii?q?nDrZDWPd4bqbKhAw9JzoYj7A6yACu839QdmXkLNVZFeBOcj4j1IFzOO/D5DfKn?= =?us-ascii?q?g1u2ijtrxvbGPqfgAprXNHTDnq3hLv5B7BtXwQ83iNRe/I58C7cbIfu1VFWims?= =?us-ascii?q?bfC0oHOgC1xq6zFtxx14Y2Q2uDBbGUNOXIrAnbtaoUP+CQadpN637GIP8/6qu2?= =?us-ascii?q?1CJrqRomZaCsmKAvRjW4E/BheRTLb332nd4bHT5S5Qh4SeXrjBuTWDhfamb0Wa?= =?us-ascii?q?8gtGliWdCWSLzbT4Xou4SvmSKyH5lYfGdDUwreC37kcJuJX7EWdXDLe5Mzonk/?= =?us-ascii?q?TbGkDrQZ+1S2rgajkeh9J+bT5CAc84j+hoB4?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CTDwDrnaBdh/bGLQVmHQEBAQkBEQUFA?= =?us-ascii?q?YF7gUtQgUUxKoQjjmCBaoQSh2SPVQkBAwEMLwEBghSCNoJWGwcBBDQTAgwBAQQ?= =?us-ascii?q?BAQECAQIDBAETAQEBCA0JCCMBBYU0DII6IoJxBCQECwEFCAEBOAQUHAImAmwIA?= =?us-ascii?q?QGDHoJYIQOWMZtyfzOCfQEBBYJJgzKBPwmBDCiFFoMFg3MYgT9AgTgMiC6CQYJ?= =?us-ascii?q?ejQWIRYEilW1ugiwDgXWTGyGEPJUEqAyBaYF6TTIGgydQEBSBTxqJcIQ/PzKRU?= =?us-ascii?q?QEB?= X-IPAS-Result: =?us-ascii?q?A0CTDwDrnaBdh/bGLQVmHQEBAQkBEQUFAYF7gUtQgUUxKoQ?= =?us-ascii?q?jjmCBaoQSh2SPVQkBAwEMLwEBghSCNoJWGwcBBDQTAgwBAQQBAQECAQIDBAETA?= =?us-ascii?q?QEBCA0JCCMBBYU0DII6IoJxBCQECwEFCAEBOAQUHAImAmwIAQGDHoJYIQOWMZt?= =?us-ascii?q?yfzOCfQEBBYJJgzKBPwmBDCiFFoMFg3MYgT9AgTgMiC6CQYJejQWIRYEilW1ug?= =?us-ascii?q?iwDgXWTGyGEPJUEqAyBaYF6TTIGgydQEBSBTxqJcIQ/PzKRUQEB?= X-IronPort-AV: E=Sophos;i="5.67,284,1566856800"; d="scan'208";a="405803228" X-MGA-submission: =?us-ascii?q?MDH6fu24YuIQtD5psmjmzOOgWe0yNKS0ycwZBA?= =?us-ascii?q?D+N/U0Ajv5MbacujUylG+27ME7jscg1WekrwFW2h39Ni5sNusVg+RTh8?= =?us-ascii?q?SK7hr+qlpEvnWVu0NdceSKF0EXiy0T6iCh8m5GMSDlwmbjy5dyuNSt0x?= =?us-ascii?q?rb9kNZAzFAu9t8a0zLWc04eA=3D=3D?= Received: from forward103j.mail.yandex.net ([5.45.198.246]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Oct 2019 17:24:36 +0200 Received: from mxback15o.mail.yandex.net (mxback15o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::66]) by forward103j.mail.yandex.net (Yandex) with ESMTP id E0ECD67405D0 for ; Fri, 11 Oct 2019 18:24:34 +0300 (MSK) Received: from sas2-69645cccb3fe.qloud-c.yandex.net (sas2-69645cccb3fe.qloud-c.yandex.net [2a02:6b8:c08:bd8e:0:640:6964:5ccc]) by mxback15o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 6SAOnpUhun-OYHagshg; Fri, 11 Oct 2019 18:24:34 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=radovel.ru; s=mail; t=1570807474; bh=v/XfDcW7zgus64Wf0pTqKB+ojAfcRyorcydUEfQNpAA=; h=Subject:From:To:Date:Message-ID; b=aAz2494sxF9yjjIHqrVveUpD4QiP8u/OjOQnavnIs9ByVziHSWAH41ao75/99og35 X1aQL+r3DoUf52YBLDlFIUCdqUbu88pDYfpLFoIVNtmaKINxhQXej35cOl/O798mzr KpFg4A45HQ9HYuzQ1z6OZD8lgTwYwq9Aro4/2ihc= Received: by sas2-69645cccb3fe.qloud-c.yandex.net (nwsmtp/Yandex) with ESMTPSA id furiBgH15r-OYqGC0nr; Fri, 11 Oct 2019 18:24:34 +0300 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client certificate not present) To: caml-list@inria.fr From: Vadim Message-ID: <0634cce4-0468-c10e-30c8-8e8e7ec937d7@radovel.ru> Date: Fri, 11 Oct 2019 18:24:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: [Caml-list] How to shadow nested submodules? Reply-To: Vadim X-Loop: caml-list@inria.fr X-Sequence: 17842 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hello! I'm trying to figure out how shadow/override nested modules in OCaml. For example, I want to make ipaddr lib aware of ppx_deriving_yojson, so I'm trying something like: > module type IpaddrS = module type of Ipaddr > module Ipaddr = struct >   include (Ipaddr : IpaddrS) >   let to_yojson t = `String (to_string t) >   let of_yojson = function >     | `String s -> begin match of_string s with >         | Error (`Msg e) -> Error e >         | Ok r -> Ok r >       end >     | _ -> Error "Expected string" >   module Prefix = struct >     include Ipaddr.Prefix >     let to_yojson t = `String (to_string t) >     let of_yojson = function >       | `String s -> begin match of_string s with >                      | Error (`Msg e) -> Error e >                      | Ok r -> Ok r >                      end >       | _ -> Error "Expected string" >   end > end > > type t = { >     addr: Ipaddr.t; >     net: Ipaddr.Prefix.t; >   } [@@deriving yojson] but it fails with > Error: Multiple definition of the module name Prefix. >        Names must be unique in a given structure or signature. because `include (Ipaddr : IpaddrS)` has already added it. I can handle it with copy and pasting the whole signature of Ipaddr module (`module type IpaddrS = sig ...end`) but its too big. Is there any ways to do it without copypasting?