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 F34465D4 for ; Wed, 26 Feb 2020 21:01:10 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.70,489,1574118000"; d="scan'208";a="437802631" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 26 Feb 2020 22:01:08 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 1F0D87F440; Wed, 26 Feb 2020 22:01:08 +0100 (CET) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 0C8C67F3B1 for ; Wed, 26 Feb 2020 22:00:59 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=tofgarion@runbox.com; spf=Fail smtp.mailfrom=tofgarion@runbox.com; spf=None smtp.helo=postmaster@smtpextng.isae.fr IronPort-PHdr: =?us-ascii?q?9a23=3Axjz2MBBn7T352/g1V/ekUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSPT6pcbcNUDSrc9gkEXOFd2Cra4d16yH7+u5BTBIyK3CmU5BWaQEbwUCh8?= =?us-ascii?q?QSkl5oK+++Imq/EsTXaTcnFt9JTl5v8iLzG0FUHMHjew+a+SXqvnYdFRrlKAV6?= =?us-ascii?q?OPn+FJLMgMSrzeCy/IDYbxlViDanbr5+MRq7oR/Vu8QZjoduN6k8xxTUqXZUZu?= =?us-ascii?q?pawn9lKl2Ukxvg/Mm74YRt8z5Xu/Iv9s5AVbv1cqElRrFGDzooLn446tTzuRbM?= =?us-ascii?q?UQWA6H0cUn4LkhVTGAjK8Av6XpbqvSTksOd2xTSXMtf3TbAwXjSi8rtrRRr1gy?= =?us-ascii?q?oJKzI17GfagdF2galGohyuugZ/zpbaYI6bNPRwYL7TctEUS2RCUcleSyNPD5ig?= =?us-ascii?q?b4sWE+YNIfpUopP/qlYIsBCwBROsBOTqyjJQmHL23bc60+U6EQHa2wwgB9IOv2?= =?us-ascii?q?rJp9v0LqgSS+G1zK7OzT7eaP5WxTD96IbHch87u/GMXLVwcczKxEk1CgPFiE6f?= =?us-ascii?q?qYvqPj+PyusNtG2b4vNmWOmyhWAnrARxrSKuxscqkoTJiYMVykzE9SVk24k5P8?= =?us-ascii?q?G3SEl+YdOiDZBetDmaOpNrTs4mXW1koiI3x7MctZKlfCUHx44ryh3DZ/CfboSF?= =?us-ascii?q?4BPuWPyMLTp4h39pYq+zihSo/US91uHxWM+520tQoCVfiNnDrHUN2gTT6seZTv?= =?us-ascii?q?t9+V+s2S2K1wDP8uFLP081lbbdK54u2LIwl4ETvl7dESPslkX2lreadkQi+ue2?= =?us-ascii?q?9+Tqeqjqq5uCO4NujgzzPL4iltK/DOk3KAQDXHSX9fy51LL5/E35RLtKjucxkq?= =?us-ascii?q?ncqJ3aOcMbpqC2AwBPyIYj6hG/DzG93dQCgHkHKklKeBWIjoTzJ17OJ/X4Ae+l?= =?us-ascii?q?g1uwiDdr2+zGPrr5D5rRNHfDlbPhca95605d0woz0ctS54lUC7EEOPL8QFX9tN?= =?us-ascii?q?3eDh8jMgy72fzrCNtn1tBWZWXaLKueKqLbtxeh4O0iJ+SQeI5d7DH2N/EN//nq?= =?us-ascii?q?nHQ5nkUae++nx81ERmq/G6FNI1+YembrmtcMWUgDpAs5SqS+lFqMXjdJZnG0d7?= =?us-ascii?q?gh4Ds8GMStCoKVFdPlu6CIwCruRs4eXWtBEF3ZSS61JbXBYO8FbWepGuEkkjEA?= =?us-ascii?q?UuHwGZQkyQmjpBP8xPxmNePZvCMC58q6hYpFotbLnBR3zgRaSsGU0mWDVWZxxz?= =?us-ascii?q?laXSIw1qdv50d6zwXfiPQqs7ljDdVWoshxfEIiL5eFlb5gFtb4XRKHddCMGg6r?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0B7BQAq3FZefVD+XcBcCh0BATgFBQECC?= =?us-ascii?q?QGBVYE+AhKBQVcwKoQUiQOICI9zhWKFaAkBAwEMIwoCBAEBhEACggEZAww0EwI?= =?us-ascii?q?QAQEFAQEBAgECAwQBEwEBCxQIhWcMgjsigwcBAgIBI1YFCwsODAIFIQICDwFHB?= =?us-ascii?q?hODJ4JJAREgAQMBCq9jgTKENQGDFgGCcQaBDigCAQGMIxqCAIFHgi8uPoJkAoE?= =?us-ascii?q?4LYMRgl4EsBaCRodRjzCOeYw1lW6BfpJzgWmBek0jUIJsUBgNkhCKVkIxgSmQN?= =?us-ascii?q?QEB?= X-IPAS-Result: =?us-ascii?q?A0B7BQAq3FZefVD+XcBcCh0BATgFBQECCQGBVYE+AhKBQVc?= =?us-ascii?q?wKoQUiQOICI9zhWKFaAkBAwEMIwoCBAEBhEACggEZAww0EwIQAQEFAQEBAgECA?= =?us-ascii?q?wQBEwEBCxQIhWcMgjsigwcBAgIBI1YFCwsODAIFIQICDwFHBhODJ4JJAREgAQM?= =?us-ascii?q?BCq9jgTKENQGDFgGCcQaBDigCAQGMIxqCAIFHgi8uPoJkAoE4LYMRgl4EsBaCR?= =?us-ascii?q?odRjzCOeYw1lW6BfpJzgWmBek0jUIJsUBgNkhCKVkIxgSmQNQEB?= X-IronPort-AV: E=Sophos;i="5.70,489,1574118000"; d="scan'208";a="340533495" X-MGA-submission: =?us-ascii?q?MDH/2K9gxMaboC1PF2e9Dc2bDb0hjJiTOeUNjM?= =?us-ascii?q?WPuw+NxUtEcwVYMCZ5Gy/JJ+R716TZgHtGt2oGfrGDTiylaDhEnnTYsm?= =?us-ascii?q?tKC28YV4qalVBefpZfHTaIJVisKiX8HDm/UJ57omexP1XkmYMZc3/E4D?= =?us-ascii?q?K8NfIlwDYDtLebnM6Jw57q1Q=3D=3D?= Received: from smtpextng.isae.fr ([192.93.254.80]) by mail3-smtp-sop.national.inria.fr with ESMTP; 26 Feb 2020 22:00:57 +0100 Received: from smtp-int-tech (smtp-int-tech.isae.fr [10.132.1.56]) by smtpextng.isae.fr (Postfix) with ESMTP id 4C4A971261; Wed, 26 Feb 2020 22:00:57 +0100 (CET) Received: from smtp-secung (smtp-secung.isae.fr [192.93.254.79]) by smtp-int-tech (Postfix) with ESMTP id 40387405047; Wed, 26 Feb 2020 22:00:57 +0100 (CET) Received: from port-garion (unknown [176.158.17.103]) by smtp-secung (Postfix) with ESMTPSA id 3292473F49; Wed, 26 Feb 2020 22:00:57 +0100 (CET) Received: from [::1] (helo=port-garion) by port-garion with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1j73nb-000jf0-IO; Wed, 26 Feb 2020 22:00:55 +0100 References: <877e09fjs7.fsf@port-garion.isae.fr> <83871ab5-6859-c684-9457-81fb847147df@polychoron.fr> User-agent: mu4e 1.2.0; emacs 26.3.50 From: Christophe Garion To: Florian Angeletti Cc: caml-list@inria.fr In-reply-to: <83871ab5-6859-c684-9457-81fb847147df@polychoron.fr> Date: Wed, 26 Feb 2020 22:00:55 +0100 Message-ID: <87v9ntdpx4.fsf@port-garion.isae.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] Printer for lists in toplevel is different when opening List Reply-To: Christophe Garion X-Loop: caml-list@inria.fr X-Sequence: 18023 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: On Wed, Feb 26 2020 at 07:36:48 PM, Florian Angeletti = wrote: > The printer for lists is indeed quite sensitive to the exact path of > the type being printed. > > Any manipulation that muddles this path makes the printer revert to > the generic sum type printer. > > Moreover, in the case of `List`, the list type is re-exported as > > type |'a| t =3D|'a list| =3D > | [] > | (::) of 'a * 'a list > > Thus after opening the List module, the toplevel printer sees > > 1 :: (2 :: ...) > > as > > ( 1 :: (2 :: ... : 'a list) : 'a t) > > And since t is different that list, it prints the value as > > (::)(1, ...) > > then starting from the second element, we are back to 'a list and the > pretty list printer. OK, thanks for the explanation! > This means that we can make the situation worse by re-exporting the > type list as > > type |'a| t =3D|'a list| =3D > | [] > | (::) of 'a * 'a t > > With this definition, we completely confuse the pretty printer for > lists and are rewarded with: > > # [1;2];; > > - : int t =3D (::) (1, (::) (2, [])) > > If you are interested, I have a small patch that makes the toplevel > printer identify the list type more reliably: > https://github.com/ocaml/ocaml/pull/9336 . Thanks, as Nicol=C3=A1s asked me to open an issue, I will point to your PR. Best, Christophe -- Christophe Garion GPG: 1982 15B2 64AC 3C34 532D BF19 6CD6 246C 62DA 5A7F