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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 79CCA7F168 for ; Thu, 27 Aug 2015 12:11:26 +0200 (CEST) IronPort-PHdr: 9a23:PSbCyxfIq1T2VfQCZHMDlPhblGMj4u6mDksu8pMizoh2WeGdxc69ZB7h7PlgxGXEQZ/co6odzbGG6Oa+BSdauN6oizMrTt9lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUiv2OQc9HOnpAIma153xjLDpvcOPKF8RzBOGIppMbzyO5T3LsccXhYYwYo0Q8TDu5kVyRuJN2GlzLkiSlRuvru25/Zpk7jgC86l5r50IAu3GePETTaZZFyghK2ACxFPkuAOLGQCP/HoHTmIOklxIBAXK4QvSQoq0uCbgsut7niWXa57YV7cxDBav9apuSRKgpCYCNjg+uDXVhs11jaRciBCooRFk35TZbZ3TP/17KPCONegGTHZMC54CHxdKBZmxOtMC Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jdimino@janestreet.com; spf=Pass smtp.mailfrom=jdimino@janestreet.com; spf=None smtp.helo=postmaster@mxout4.mail.janestreet.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jdimino@janestreet.com) identity=pra; client-ip=38.105.200.233; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jdimino@janestreet.com designates 38.105.200.233 as permitted sender) identity=mailfrom; client-ip=38.105.200.233; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="jdimino@janestreet.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@mxout4.mail.janestreet.com) identity=helo; client-ip=38.105.200.233; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jdimino@janestreet.com"; x-sender="postmaster@mxout4.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BHAQDN4d5VnOnIaSZdhFgGgx2BB7lMAQmHcwKBKQc4FAEBAQEBAQEBEAEBAQEBBhYJT4IdggcBAQMBEhEEGQEBNwEECwkCBAEGNwICIhIBBQEcBhMiiAQIA5Vyjz+BLz4xik9xhGUBBZAjAQEBAQEFAQEBAQEBAQEUBgqLV4ULB4JpgUOVQoxzgUqVK4IfEiOBFxeED3CCTQEBAQ X-IPAS-Result: A0BHAQDN4d5VnOnIaSZdhFgGgx2BB7lMAQmHcwKBKQc4FAEBAQEBAQEBEAEBAQEBBhYJT4IdggcBAQMBEhEEGQEBNwEECwkCBAEGNwICIhIBBQEcBhMiiAQIA5Vyjz+BLz4xik9xhGUBBZAjAQEBAQEFAQEBAQEBAQEUBgqLV4ULB4JpgUOVQoxzgUqVK4IfEiOBFxeED3CCTQEBAQ X-IronPort-AV: E=Sophos;i="5.17,422,1437429600"; d="scan'208";a="143941715" Received: from mxout4.mail.janestreet.com ([38.105.200.233]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2015 12:11:25 +0200 Received: from tot-qpr-mailcore2.delacy.com ([172.27.56.106] helo=tot-qpr-mailcore2) by mxout4.mail.janestreet.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1ZUu9U-0000uW-3u for caml-list@inria.fr; Thu, 27 Aug 2015 06:11:24 -0400 X-JS-Flow: external Received: by tot-qpr-mailcore2 with JS-mailcore (0.1) (envelope-from ) id BV3uJM-AAAG6d-Cl; 2015-08-27 06:11:24.083687-04:00 Received: from mail-io0-f178.google.com ([209.85.223.178]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1ZUu9U-0000XU-03 for caml-list@inria.fr; Thu, 27 Aug 2015 06:11:24 -0400 Received: by iods203 with SMTP id s203so51296980iod.0 for ; Thu, 27 Aug 2015 03:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=zX+MXrq2gGlneXUJ9CEadQzv70kJy5/+WMdhZW6WWhc=; b=JHjx6kgRoyG92enoa4TC1+Oycig/MW8VpEhMdRrV5M52KHSmtgEqHVLp2OFYyD408T 2o1Duu/r59OOH+LPBI2BlcNHU1m4EG6u0gDSQpfwwdRyPWDHd0JDwZs6qsmWkfIYhzyX bLjdrh8AayzM7E1/rMLazP/GnzL0H/YzVYjZ0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=zX+MXrq2gGlneXUJ9CEadQzv70kJy5/+WMdhZW6WWhc=; b=TbG19xZY8b76MyN5WasgxNZU3Ypii98PZI/GDL9DnlaZsmakisqPmZN1hyuh9Gx+02 Z+FSgI0qvOhMT8kMVqf7+c8u+I/jNUCXNAG5lMwGVIipVyvOdyDu9K/MoM/yfUaEVZa9 7cX/ttPjdlaiuBWDRSh9D9GU7IWdmEssWx01F4/JhwVASLZ5naGEQ9HbK0zk8f7dYPrn Zw/EWUKd8wvFAgpKssRV2rpgyifPGWNpoVQzsJQWiXLSCXK1SyFrG8rQZt7faFLbLwKD tF9rO2TYf4p041saMMCzsjm53EuHtsOGw5TtPDHy0g4GHBpndQSz5SH3h+NtMVrqA2Z1 la3Q== X-Gm-Message-State: ALoCoQkCrs3xXjRAUVq3gTosVuWv7UbOG4uebuJZ7zsxW4EnWd/YDWXJqk3Q0PpkMBlH0LGnOHsWaTVo8FKJ8sjzUL6iJjtOoMaFwIj7OWoGwOMTsHNlKuG+p1NEAIeZBmYEP0rWNyt/ X-Received: by 10.107.130.156 with SMTP id m28mr10139566ioi.56.1440670283645; Thu, 27 Aug 2015 03:11:23 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.107.130.156 with SMTP id m28mr10139552ioi.56.1440670283513; Thu, 27 Aug 2015 03:11:23 -0700 (PDT) Received: by 10.50.134.163 with HTTP; Thu, 27 Aug 2015 03:11:23 -0700 (PDT) In-Reply-To: <55DEDF9B.5020006@tu-berlin.de> References: <55DEDF9B.5020006@tu-berlin.de> Date: Thu, 27 Aug 2015 11:11:23 +0100 Message-ID: From:Jeremie Dimino To:=?UTF-8?Q?Christoph_H=C3=B6ger?= Cc:caml users Content-Type: multipart/alternative; boundary=001a113ecfda7cdd42051e483009 X-JS-Processed-by: mailcore Subject: Re: [Caml-list] why is this definition less general? --001a113ecfda7cdd42051e483009 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Aug 27, 2015 at 10:59 AM, Christoph H=C3=B6ger < christoph.hoeger@tu-berlin.de> wrote: > Obviously, 'a is bound by its first occurrence in the type annotation, > here. Can someone explain this behavior? =E2=80=8BIn a type annotation, the scope of variables is only the type anno= tation. So in your example the ['a] in the annotation of [a_to_opt] and the ['a] in the annotation of [None] are distinct. To refer to the same type, you need to use a local abstract type: let rec a_to_opt : type a. (a -> a option) =3D fun x -> (None : a =E2=80=8B option=E2=80=8B )=E2=80=8B=E2=80=8B --=20 Jeremie --001a113ecfda7cdd42051e483009 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On Thu, Au= g 27, 2015 at 10:59 AM, Christoph H=C3=B6ger <christoph.hoeger@tu-berlin.de><= span style=3D"font-family:arial,sans-serif"> wrote:
Obviously, = 'a is bound by its first occurrence in the type annotation,
here. Can someone explain this behavior?

=E2=80=8BIn a type annotation, the scope of variables is only the type a= nnotation. So in your example the ['a] in the annotation of [a_to_opt] = and the ['a] in the annotation of [None] are distinct. To refer to the = same type, you need to use a local abstract type:

= =C2=A0 =C2=A0 let rec a_to_opt : type a= . (a -> a option) =3D fun x -> (None : a
=E2=80=8B o= ption=E2=80=8B
)=E2=80=8B=E2=80=8B
=C2=A0
=
--=C2=A0
Jeremie
--001a113ecfda7cdd42051e483009--