From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by sympa.inria.fr (Postfix) with ESMTPS id 824177EE0C for ; Wed, 28 Nov 2012 11:32:40 +0100 (CET) Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of lambda.q.q@gmail.com) identity=pra; client-ip=209.85.215.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="lambda.q.q@gmail.com"; x-sender="lambda.q.q@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail4-smtp-sop.national.inria.fr: domain of lambda.q.q@gmail.com designates 209.85.215.54 as permitted sender) identity=mailfrom; client-ip=209.85.215.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="lambda.q.q@gmail.com"; x-sender="lambda.q.q@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail4-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-la0-f54.google.com) identity=helo; client-ip=209.85.215.54; receiver=mail4-smtp-sop.national.inria.fr; envelope-from="lambda.q.q@gmail.com"; x-sender="postmaster@mail-la0-f54.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiEBANfntVDRVdc2imdsb2JhbAA8CcAXCBYOAQEBCgkNBxIGI4IeAQEEAToGATgBAwELAQUFISUPAQQNEwEFASITh30DCQYEoC+PLYUaJw2JTgEFDItKe4QvA4hYi1SBVYs0gzA/gVeCPw X-IronPort-AV: E=Sophos;i="4.84,177,1355094000"; d="scan'208";a="164061684" Received: from mail-la0-f54.google.com ([209.85.215.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 28 Nov 2012 11:32:39 +0100 Received: by mail-la0-f54.google.com with SMTP id j13so17601581lah.27 for ; Wed, 28 Nov 2012 02:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=sIIaYC000zW3WDFQXTZKVzmrloavgjsCOk70PFNQc5s=; b=VX7FH019eV7vrm9n9bEIgKQxqdctkQVFgmYYyMZZ5/QI3mgE7LaIa2bEJcrdlWHIhS eNiyjPtIoMw5fra6Z6I/pfrfEbVjels/Nu6WKF/bcqRUbV+LYVEJVxilgdBWJW9ThwQj QpBG7+NtokZJbL3J8vWE/wYWzDQV7nS6+YeAcGxISWx3/dDYljNQckPtLnQRpz3Sd9ON 0QgNDyfFFic2Y9Uuwfl+x6br4Bty+SKJTdKBr0Bf6FI1eeJ272beshMFQ53d4e2X9iak PGYAsCoVOOv+VMezJt+gdPUGU7gotkxzsDJSTY6K0yGZ60eOo03clmkHjKIjpfMHe8nO Y+Ow== Received: by 10.152.133.140 with SMTP id pc12mr17483942lab.53.1354098759454; Wed, 28 Nov 2012 02:32:39 -0800 (PST) Received: from golf.niidar.ru.niidar.ru ([178.176.188.42]) by mx.google.com with ESMTPS id sq2sm1619501lab.14.2012.11.28.02.32.37 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 28 Nov 2012 02:32:38 -0800 (PST) Sender: Ivan Gotovchits From: Ivan Gotovchits To: Gabriel Scherer Cc: Jacques Garrigue , caml-list@inria.fr References: <87ip8rwbsc.fsf@golf.niidar.ru> <1F656500-76AC-482F-BA08-A9BB8250D904@math.nagoya-u.ac.jp> <87fw3uxuja.fsf@golf.niidar.ru> Date: Wed, 28 Nov 2012 14:32:30 +0400 In-Reply-To: (Gabriel Scherer's message of "Wed, 28 Nov 2012 09:12:35 +0100") Message-ID: <878v9muif5.fsf@golf.niidar.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Caml-list] phantom types and identity function Gabriel Scherer writes: > The reason for this behavior is that in the first case, t was inferred > covariant, while the presence of a constraint disables variance > inference (in the manual: "otherwise (ie. [...] for non-free > parameters) the variance must be given explicitly)"). You can make the > constrained version work with an explicit variance annotation: > type +'a t = {x : 'a} constraint 'a = [< `A | `B ];; > let f x = (x : [ `A ] t :> [ `A | `B ] t);; Well, now I understand this. Thanks! > While we're at it: are you sure you need to play with phantom > polymorphic variant types now that we have GADTs? I have used phantom > types in the past, but my personal use cases would be profitably > rewritten using GADTs. They tend to produce hairy error messages, but > phantom polymorphic variants are not better in this regard. I wish I could, but I'm bond to Ocaml 3.11 =( -- (__) (oo) /------\/ / | || * /\---/\ ~~ ~~ ...."Have you mooed today?"...