From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 5D8C17EE25 for ; Tue, 4 Jun 2013 09:23:37 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of lambda.q.q@gmail.com) identity=pra; client-ip=209.85.217.179; receiver=mail3-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 (mail3-smtp-sop.national.inria.fr: domain of lambda.q.q@gmail.com designates 209.85.217.179 as permitted sender) identity=mailfrom; client-ip=209.85.217.179; receiver=mail3-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 (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-lb0-f179.google.com) identity=helo; client-ip=209.85.217.179; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="lambda.q.q@gmail.com"; x-sender="postmaster@mail-lb0-f179.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhIBACSTrVHRVdmzlGdsb2JhbABZhi69ERYOAQEBAQcLCwkSKoIjAQEEAScTBgE4AQMBCwEFBSElDwEEDRMBBQEiE4d7AwkGBJ5Wj0eFNScNiQYBBQyMQIY5A4kajD6BZowdgz4/gV2CXQ X-IPAS-Result: AhIBACSTrVHRVdmzlGdsb2JhbABZhi69ERYOAQEBAQcLCwkSKoIjAQEEAScTBgE4AQMBCwEFBSElDwEEDRMBBQEiE4d7AwkGBJ5Wj0eFNScNiQYBBQyMQIY5A4kajD6BZowdgz4/gV2CXQ X-IronPort-AV: E=Sophos;i="4.87,798,1363129200"; d="scan'208";a="16664064" Received: from mail-lb0-f179.google.com ([209.85.217.179]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 04 Jun 2013 09:23:36 +0200 Received: by mail-lb0-f179.google.com with SMTP id w20so300010lbh.24 for ; Tue, 04 Jun 2013 00:23:36 -0700 (PDT) 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=DF4YXKO7r8wXDf9hQCcBuOtrNGYEHAwGipIQtg4zIW4=; b=hcLXQ+Ep2a+KruH3TxhiFBncKZVYzbpYx+8KHpAr9ZYwmuKi3wk2fXNpbX7rJo4rvY obtKCQBowuodLyliPJv+oCy8uY9HtXdDPMoW0BTAFV+foLytA5Ei5sBkB2SVz9MY9m1c 8xYttNWh4wT2mdp/keu6TMNWk3WUVnilINauMElQ4CfIsSBanHqvLE1jU2lK8wUkWYDX jAZ5IFU/HdZ1gVFmbhIMkCvLNQzKVvFr2KbgR/cRT5AB4ARmU3KbTeoPy/AXTsLmGVGv 9ZFs1IJce+hBmKxe89mmz+YMXdg6hyWG5gmMYblxSUL+2OXF1ap8ETKzh4mSbM8MwJ4p 1E1Q== X-Received: by 10.112.146.233 with SMTP id tf9mr12426036lbb.33.1370330615950; Tue, 04 Jun 2013 00:23:35 -0700 (PDT) Received: from golf.niidar.ru.niidar.ru ([109.188.125.224]) by mx.google.com with ESMTPSA id o6sm4812658laj.2.2013.06.04.00.23.34 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Tue, 04 Jun 2013 00:23:35 -0700 (PDT) Sender: Ivan Gotovchits From: Ivan Gotovchits To: Gabriel Scherer Cc: caml-list@inria.fr References: <87ehciseni.fsf@golf.niidar.ru> Date: Tue, 04 Jun 2013 11:23:23 +0400 In-Reply-To: (Gabriel Scherer's message of "Tue, 4 Jun 2013 07:47:06 +0200") Message-ID: <87a9n6s5jo.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] GADT and locally ADT Gabriel Scherer writes: > If the function knows (or infer) that the argument type is (ro), then > there is only one case to handle. But there is also a function that is > polymorphic over the second argument, and it must be callable with > both (ro) and (rw) values : this function works "for any access mode". > This is what the annotated function > >> let f (type t) (inp: ('a,t) access) = match inp with >> | ReadWrite (ch) -> () >> | Read (ch) -> ();; > > does. Looks reasonable, but can you, please, explain the difference between function: let f (type t) (inp: ('a,t) access) = match inp with | ReadWrite ch -> () | Read ch -> () that have type val f : ('a, 'b) access -> unit and let f (inp: ('a,'b) access) = match inp with | ReadWrite ch -> () | Read ch -> () that fails to type check: Error: This pattern matches values of type ('a, ro) access but a pattern was expected which matches values of type ('a, rw) access