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 ESMTPS id 2389B5D5 for ; Wed, 8 Jan 2020 06:55:12 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.69,408,1571695200"; d="scan'208";a="430339784" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 08 Jan 2020 07:55:08 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 938ED7F3D3; Wed, 8 Jan 2020 07:55: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 B882D7F214 for ; Wed, 8 Jan 2020 07:55:01 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=rixed@happyleptic.org; spf=Pass smtp.mailfrom=rixed@happyleptic.org; spf=Pass smtp.helo=postmaster@wout4-smtp.messagingengine.com IronPort-PHdr: =?us-ascii?q?9a23=3AZJEgTxLsg7xSGO9GpdmcpTZWNBhigK39O0sv0rFi?= =?us-ascii?q?tYgRLfjxwZ3uMQTl6Ol3ixeRBMOHsqkC0beJ+Pm4ASQp2tWoiDg6aptCVhsI24?= =?us-ascii?q?09vjcLJ4q7M3D9N+PgdCcgHc5PBxdP9nC/NlVJSo6lPwWB6nK94iQPFRrhKAF7?= =?us-ascii?q?Ovr6GpLIj8Swyuu+54Dfbx9HiTagb75+Ngu6oAXTu8UZnIduNro9wQbVr3VVfO?= =?us-ascii?q?hb2XlmLk+JkRbm4cew8p9j8yBOtP8k6sVNT6b0cbkmQLJBFDgpPHw768PttRnY?= =?us-ascii?q?UAuA/WAcXXkMkhpJGAfK8hf3VYrsvyTgt+p93C6aPdDqTb0xRD+v4btnRAPuhS?= =?us-ascii?q?waLDMy7n3ZhdJsg6JauBKhpgJww4jIYIGOKfFyerrRcc4GSWZdW8pcUTFKDIGh?= =?us-ascii?q?YIsVF+cPOuhXoIb+qVQMoxuwCwmiCv3yxDBUnXL2wbE23v49HQzcxgEsA9QDu2?= =?us-ascii?q?nUotXvM6cSVPi4zLPJzTTMcfxZxCzw6IjSfRA5ufGNXbZwftTJyUkzFgPKkk+c?= =?us-ascii?q?qYv/PzOa0OkGrmuV7/J4WO+uhGMrsRx9rzety8s2l4XFmIwYxkra+Sllxos+OM?= =?us-ascii?q?e2R1RhYdG+FZtdryGaOJVyQsMlW2xptiE6yqAauZO0ZSQK05EnxwLHa/CddoiH?= =?us-ascii?q?/AnjVP2LLjd3hXJlfr2/iAi08Uivy+38UNe73ExWoSpCl9nArnEN1xrN5cibUv?= =?us-ascii?q?Zw/0is1SyS2w3c6OxIO104mbTVJpI73LI8ioIfsUHZES/3nEX2grWWdkIh+uWw?= =?us-ascii?q?8eTnY7rnqYGBOIJvigHxKLwumtS/AOQ8LAcOR3Sb+eWg27H5+k35WrpKguUskq?= =?us-ascii?q?bFqJDaOdgbpqmhDgBJyIkj7hK/Ay6i0NQZhnkHMElIeAmHjojsI1HBOur0Dfa5?= =?us-ascii?q?g1S2kTdk3erKPrP7ApjLM3POjrPhfatm605A1gUz181R55NVC74fOP//Rhy5iN?= =?us-ascii?q?uNRD4nOgr87OH7D8t21oICQijHVq6HP4vTvFKFoOU1LL/fSpUSvWPnKugo69bu?= =?us-ascii?q?hGchiFsQZbWo1t0Qcn/rTbxdP0yFbC+00Z86GmAQs197FbSy0QHQYXtof3+3Gp?= =?us-ascii?q?kEyHQjEov/UtXDT5i1kbiMxDu6FdtRfG8UUgnRQ0etTJ2NXrI3UAzXIsJllWde?= =?us-ascii?q?B6emVpN9kAqrqBe8zrd8NePb+ysXuJTs1d54oebUkENrrG0mP4Gmy2iIClpMsC?= =?us-ascii?q?YNTj4y0rp4pBUimFeKybBph/FACd1YofRTXVVjOA=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CkBABdfBVegBR7k0BmHAEBAQEBBwEBE?= =?us-ascii?q?QEEBAEBgXwCg2gBMSqMLl6IBSWZPIF6CQEDAQwvAQGEQAKBaR0GAQQ4Ag0CEAE?= =?us-ascii?q?BBAEBAQIBAgMEARMBAQsLCQgnhUAMgjspAYJ6AQIDJxkBATcBDwsOCi4sKwaDN?= =?us-ascii?q?YJ4rHUzgn4BAQWCP4NWgR4JgTYBhRyCI4IUgkUaggCBEScMA4IvLj6KN41GixS?= =?us-ascii?q?WSphYCBmaYKleggCBY31DLoI+UBgNjRKDc4UUhUBAAQIwkHwBAQ?= X-IPAS-Result: =?us-ascii?q?A0CkBABdfBVegBR7k0BmHAEBAQEBBwEBEQEEBAEBgXwCg2g?= =?us-ascii?q?BMSqMLl6IBSWZPIF6CQEDAQwvAQGEQAKBaR0GAQQ4Ag0CEAEBBAEBAQIBAgMEA?= =?us-ascii?q?RMBAQsLCQgnhUAMgjspAYJ6AQIDJxkBATcBDwsOCi4sKwaDNYJ4rHUzgn4BAQW?= =?us-ascii?q?CP4NWgR4JgTYBhRyCI4IUgkUaggCBEScMA4IvLj6KN41GixSWSphYCBmaYKleg?= =?us-ascii?q?gCBY31DLoI+UBgNjRKDc4UUhUBAAQIwkHwBAQ?= X-IronPort-AV: E=Sophos;i="5.69,408,1571695200"; d="scan'208";a="335091825" X-MGA-submission: =?us-ascii?q?MDEM4aHl/xJ/SdswAWbW+Yji9pJ0KSCjMLZXUu?= =?us-ascii?q?qPoB115MHC2DGM5JaE24wiW+Lg60KUKw4K9mnzff9t58HZXsunu2rbE6?= =?us-ascii?q?wUqJRobfL7YEt/tZg8y+acTPYXjI/MGqxYS8MgIXGb2yjDkzlgAk1WrT?= =?us-ascii?q?uRp0R4Je8RJJZYn7MoIKu4+A=3D=3D?= Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2020 07:54:47 +0100 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id BD6E3662; Wed, 8 Jan 2020 01:54:44 -0500 (EST) Received: from imap2 ([10.202.2.52]) by compute3.internal (MEProxy); Wed, 08 Jan 2020 01:54:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=happyleptic.org; h=mime-version:message-id:in-reply-to:references:date:from:to :cc:subject:content-type; s=fm2; bh=UBceunH8pjVmSdTPkDBUiGhcE61B lpLbLCiC17mSmms=; b=a4IkyiOW2Q7zd/MjBcBB741kEfj1zLm91LPO/IWPrghB +qMiMhhfDN1nc5A3ATOjpfsMGbAA9ynZxgQUkarSpvwPlFMJac1mzCPSp+xLq05g SEyqa+pwyvyIsgErGuFHib+mez0X/wANZ8B2Cczxx6UkHuql3doL/eHp2t1Whox7 WEmimVjpQCYWU81F4N12jLQ8B45sx/6vDjPnJyji/t7wAFuILgGiKeSpl7kVnTBO UlFr74MXWUYYiVOWxxX9u5xeRQRQ2fMUmjiUGcdAnUh+WiGRjyYUJdUIz2J7lgK1 ANXmzMbLuwQwoSp8eOuIglTZ3tUPvcugxmHPiT7CsA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=UBceun H8pjVmSdTPkDBUiGhcE61BlpLbLCiC17mSmms=; b=mzXcfZT0obdS5lIiXyFT30 hL8Kx3lzaPh1OvfLCp7Ry/z9w0EHgbLWZzUY9J0ThAIeTyXMtLUQkG1fcH/0wtBU 0xrMPxikeOF58+YzTni2yy4pPEGKSAvfQlJzk3d9kFj6jq3A9VhPvqRQSBxZ1tQM akOCemkgThq9krBrSnb4x7FG4sjxU/970Qz+RcUYJ1hBxXyha97e5zurKsP4MM56 uK/dga5LyEtW+mTJbrSfVPP1tDlDlwLxYRSf9CYAlmc5lcYdJx85Wou4LrlhiGua 18g5YM4QC3UBEYlyT38GiFIRwyWernu/nqaigcrwiHjLkK3H/4IYf2V1ECC3O0DQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdehjedguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpehrihig vggusehhrghpphihlhgvphhtihgtrdhorhhgnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hrihigvggusehhrghpphihlhgvphhtihgtrdhorhhgnecuvehluhhsthgvrhfuihiivgep td X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E4598E00A5; Wed, 8 Jan 2020 01:54:43 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-731-g1812a7f-fmstable-20200106v2 Mime-Version: 1.0 Message-Id: <41592816-f82e-43a4-b67f-02e69623fe23@www.fastmail.com> In-Reply-To: References: <4d2b5367-a869-42bc-9547-b58864c10cf8@www.fastmail.com> Date: Wed, 08 Jan 2020 07:54:22 +0100 From: rixed@happyleptic.org To: "Ivan Gotovchits" Cc: caml-list Content-Type: text/plain Subject: Re: [Caml-list] Calling a single function on every member of a GADT? Reply-To: rixed@happyleptic.org X-Loop: caml-list@inria.fr X-Sequence: 17934 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 and thank you for the answer. On Tue, Jan 7, 2020, at 21:21, Ivan Gotovchits wrote: > It is the limitation of the let-bound polymorphism. (...) > In your case, I would define a visitor type, e.g., > type 'r visitor = {visit : 'a. 'a term -> 'r -> 'r} Oh I see. I've used this trick to force a function to be polymorphic, but I failed to see that this was the problem because to me `f` is not any more polymorphic when the `term` is a GADT than when it's not. So there is no lighter syntax to specify that `f` should accept any member of a GADT than the syntax to specify that `f` should accept any type at all? I wonder, is this just a limitation of the OCaml parser or is there some deep reason for these work-around (like is the case, from my understanding, for the value restriction)? Sorry for asking such simple questions but I've build a mental model of how OCaml type checking works mostly from trials and errors, which used to work great until some versions ago :)