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 351765D5 for ; Mon, 28 Oct 2019 14:28:15 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.68,240,1569276000"; d="scan'208";a="408829734" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 28 Oct 2019 15:28:14 +0100 Received: by sympa.inria.fr (Postfix, from userid 20132) id 23A0D7F318; Mon, 28 Oct 2019 15:28:14 +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 39C977F25C for ; Mon, 28 Oct 2019 15:28:06 +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@out1-smtp.messagingengine.com IronPort-PHdr: =?us-ascii?q?9a23=3AxJRxAh2mkdsIbl3fsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?sewfI/ad9pjvdHbS+e9qxAeQG9mCsLQV2qGI6OjJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6?= =?us-ascii?q?JvjvGo7Vks+7y/2+94fcbglVijexe7d/IRG5oQjQuMQdnJdvJLs2xhbVuHVDZv?= =?us-ascii?q?5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnM?= =?us-ascii?q?URGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LptRRT1ii?= =?us-ascii?q?kIKiQ5/XnQhMN+g61VoxyvqRxhzYDJfI6YL+Z+cr/HcN8GX2dMRNpdWipcCY28?= =?us-ascii?q?dYsPCO8BMP5Cr4n8qFoBswaxCBKsBOz10j9Inn/33akk3OQ5DQHG3RAvE8gJsH?= =?us-ascii?q?TOo9X4MroZX+OtzKTQzDjObula1Srg5ITVaBwsruuAUaxwfMfX1EIhDRnKjk+K?= =?us-ascii?q?pozgJz6V1voCs2yc7+d4UuKvlnInpxxorji0w8cslpHJipgQyl/a7iV525w6Jd?= =?us-ascii?q?K5SE59bt6rDp1Qty6bN4twXMwuWX1nuCE/yrEeuJ67ejYFyIg/yhPeavGLaZWE?= =?us-ascii?q?7g/+WOqLLjp0nmxpdbKnixa360egy+n8Vseu0FZNqypIisPMtnEC1hPN98eKUf?= =?us-ascii?q?t98V252TaX1wHT7v9LIVgolaraN5Et2LkwloAcsUjbBC/5hF32jLOKdkUj4uWn?= =?us-ascii?q?9/7oYrDippOFM490ixr+Mrg1l8ykAeU4NxAOUHKB9eS90r3j50z5T69Qgv04iK?= =?us-ascii?q?nUto3RKNofpq6kGA9Vzpgs6wyiATen0dUXg2EKIE4WMC6A2oPgPlWLJPHjEd++?= =?us-ascii?q?hU6tmXFl3aPoJLrkV4/MPnXPuLfoZa5s70NE1As4i9dF6MEHQoodKe7+Dxei/O?= =?us-ascii?q?fTCQU0ZlTtn7TXTe5l34ZbYlqhR7eDOfqN41+B/vo+J+SUeI4e/jHnJKp9vq+8?= =?us-ascii?q?vToCgVYYOJKR894SYXG8EO5hJhzGM3rlms8QFWoSogs1Cuvwhw/bCGMBVzOJR6?= =?us-ascii?q?s5owoDJsemAIPEHdn/h6GdhWKgG4FOIGVLEUuFHnbueIiCVPYKZWSZJcozyzE?= =?us-ascii?q?=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AsAgBa+rZdhxkEb0JlHAEBAQEBBwEBE?= =?us-ascii?q?QEEBAEBgXuDYQExKo0royYJAQMBDC8BAYgMHQYBBDQTAgwBAQQBAQECAQIDBAE?= =?us-ascii?q?TAQEBCA0JCCmFPgyCOyKDIhkBATiBDCWDQYJ4sTozgn4BAQWCPoNYgSkJgTaFF?= =?us-ascii?q?oIgghSCRRiBf4E4iDuFIZ5pjwOXViGZWqgvgWmBen1DLoI+UBAUgwYag1mFFIV?= =?us-ascii?q?AQAECMJBUAQE?= X-IPAS-Result: =?us-ascii?q?A0AsAgBa+rZdhxkEb0JlHAEBAQEBBwEBEQEEBAEBgXuDYQE?= =?us-ascii?q?xKo0royYJAQMBDC8BAYgMHQYBBDQTAgwBAQQBAQECAQIDBAETAQEBCA0JCCmFP?= =?us-ascii?q?gyCOyKDIhkBATiBDCWDQYJ4sTozgn4BAQWCPoNYgSkJgTaFFoIgghSCRRiBf4E?= =?us-ascii?q?4iDuFIZ5pjwOXViGZWqgvgWmBen1DLoI+UBAUgwYag1mFFIVAQAECMJBUAQE?= X-IronPort-AV: E=Sophos;i="5.68,240,1569276000"; d="scan'208";a="324842892" X-MGA-submission: =?us-ascii?q?MDFLaR7vMw9krv6vxcqIjA+l2nooQpHyO7sR9r?= =?us-ascii?q?r3UIbjP9a9z/+Pyawj6JUQ0XArz/ttUAb6bC+mTLHxPBqlZtsc6/yOyq?= =?us-ascii?q?fuKP7ZAuvHj1xvVmiJwCV+uwhK1YE3wttG3fRO4KaPC69sDJS1TpomK3?= =?us-ascii?q?iiis6m13Vcqrn4VV0eXkQ1EA=3D=3D?= Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 15:28:05 +0100 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 1B8B0215B2 for ; Mon, 28 Oct 2019 10:28:03 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute3.internal (MEProxy); Mon, 28 Oct 2019 10:28:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=happyleptic.org; h=mime-version:message-id:date:from:to:subject:content-type; s= fm1; bh=jExuXvqkbzQRAqrl47WKYmUemM9vHUkq1/xE/2IFq2E=; b=HCtfXchU Hjx1apKnjSylUH0+yOyQSV8VpCak7q32F97OjYJdaKJlU3xSw7tkfj22xxM1b8I7 FW30w5EnQZGiuyZ9zWznozieiKnKgybQfLWAmC17VW8NSOW0rrjYJd+x5l63FWtT vGtKWfD3UcsutMHDhgYOok6GBpJ39AN3tUblR215zz1lIYe/jHMTp/jIhntp773u Y2XFmgxnYBGhn/PZTlHOBEq7GCM1lL9qCOI5wZ9HZP3lt/4CRi0ncp7Ya8w8elBw 1EazmLwEBsybWONtHQ8Fn5ejqAnC8z1R0OVLpQQKMB2XLG8Tuv7w4R/c4GddIkeA 0EV7J4Bp3tjA4w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=jExuXvqkbzQRAqrl47WKYmUemM9vH Ukq1/xE/2IFq2E=; b=UdeIy0zM3Lzi7rXehdtA73Y1onNITucfM2bczyjq4sj3+ Jd+7QeuT4ClSkm4//gCPmB5axJGXUfcq+bwLn/i2MIyX5nIFpb8vMla1y9yRl2t0 xakksI+Q/JTikIHpKxXaLRili6HCHdhrPFYL7BOFWxTN8mk4OwpmmGwCGP3sPIv8 qlvW+b+pNDT643qiODZTXowDSe7wgCzAnUflMraCGsYzcRUeRxMquOi++oqkO+iT A+PdPDNAqccmmqTMHGli2qXnzie/pnEIZUx3RgtgwMEB4yEtiuabAZ0tuUG0P8iF 1F+5UxzvE+LB7fjnKdK3/UqVODta7zxpg0ikW2oAw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrleelgdeigecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepofgfggfkfffhvffutgesthdtredtre ertdenucfhrhhomheprhhigigvugeshhgrphhphihlvghpthhitgdrohhrghenucfrrghr rghmpehmrghilhhfrhhomheprhhigigvugeshhgrphhphihlvghpthhitgdrohhrghenuc evlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 78609E00A3; Mon, 28 Oct 2019 10:28:02 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-470-gedfae93-fmstable-20191021v4 Mime-Version: 1.0 Message-Id: Date: Mon, 28 Oct 2019 15:27:43 +0100 From: rixed@happyleptic.org To: caml-list@inria.fr Content-Type: text/plain Subject: [Caml-list] phantom types and coercion Reply-To: rixed@happyleptic.org X-Loop: caml-list@inria.fr X-Sequence: 17851 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 list. I'm trying to use several parameters in a phantom type ; everything works alright, but coercion. For instance, in the code below, how come s1 can be coerced into a string by s2 cannot ? # module M : sig type +'a t = private string val m1 : string -> [`C1] t val m2 : string -> ([`C2] * 'a) t end = struct type 'a t = string let m1 s = s let m2 s = s end;; module M : sig type +'a t = private string val m1 : string -> [ `C1 ] t val m2 : string -> ([ `C2 ] * 'a) t end # let s1 = M.m1 "foo";; val s1 : [ `C1 ] M.t = "foo" # let s2 = M.m2 "bar";; val s2 : ([ `C2 ] * 'a) M.t = "bar" # print_string (s1 :> string);; foo- : unit = () # print_string (s2 :> string);; Error: This expression cannot be coerced to type string; it has type ([ `C2 ] * 'a) M.t but is here used with type string