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 CC7A17EE34 for ; Mon, 28 Mar 2016 06:20:45 +0200 (CEST) IronPort-PHdr: 9a23:7HbRsRSRmRz//WaLTnJL8qRKdNpsv+yvbD5Q0YIujvd0So/mwa64bRWN2/xhgRfzUJnB7Loc0qyN4/CmAzdLu8rQ+Fk5M7VyFDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3CwN5K6zPF5LIiIzvjqbpq82VOV4D3mbsKZpJbzyI7izp/vEMhoVjLqtjgjDomVBvP9ps+GVzOFiIlAz97MrjtLRq8iBXpu5zv5UYCfayV+0CQLdZFDUrNXwurI2u7EGbDFjH2nxJcGwdiwdFGEDq5QvgX5jsv2OuueNnwiiVIMDeSLkoWXKk5qhsWRatlWEOPHg76DeEpNZ3ifd0uh+uoAZui6vdZIyeNPM2KqzYdNcXTmpIdslUXi1FRIi7at1cXKI6Ie9Eotyl9BM1phykCFzpXbu3xw== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=gmalecha@gmail.com; spf=Pass smtp.mailfrom=gmalecha@gmail.com; spf=None smtp.helo=postmaster@mail-ob0-f180.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of gmalecha@gmail.com) identity=pra; client-ip=209.85.214.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gmalecha@gmail.com"; x-sender="gmalecha@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of gmalecha@gmail.com designates 209.85.214.180 as permitted sender) identity=mailfrom; client-ip=209.85.214.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gmalecha@gmail.com"; x-sender="gmalecha@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-ob0-f180.google.com) identity=helo; client-ip=209.85.214.180; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="gmalecha@gmail.com"; x-sender="postmaster@mail-ob0-f180.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0B3AACvsPhWi7TWVdFcDoRwBq9yinQBDYFwhg0CgRkHOBQBAQEBAQEBARABAQEICwsJHzGCLYIUAQEBAwESEQQZARsdAQMBCwYFBAEGDSoCAiIBEQEFARwGEwgah28BAwoIojaBMT4xizaBaoJXhg8KGScNUYQdAQEBAQEBBAEBAQEBARQBBQoFhRd4hESHPIJWBY4wiTGOBo8LjU0RHoEPHgEBgjgegRZbHDCIVgEBAQ X-IPAS-Result: A0B3AACvsPhWi7TWVdFcDoRwBq9yinQBDYFwhg0CgRkHOBQBAQEBAQEBARABAQEICwsJHzGCLYIUAQEBAwESEQQZARsdAQMBCwYFBAEGDSoCAiIBEQEFARwGEwgah28BAwoIojaBMT4xizaBaoJXhg8KGScNUYQdAQEBAQEBBAEBAQEBARQBBQoFhRd4hESHPIJWBY4wiTGOBo8LjU0RHoEPHgEBgjgegRZbHDCIVgEBAQ X-IronPort-AV: E=Sophos;i="5.24,404,1454972400"; d="scan'208,217";a="171194180" Received: from mail-ob0-f180.google.com ([209.85.214.180]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 28 Mar 2016 06:20:43 +0200 Received: by mail-ob0-f180.google.com with SMTP id x3so23243057obt.0 for ; Sun, 27 Mar 2016 21:20:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JSX7z/QXsqPDJcLZ4mYuVLP5jOPyDEm75mPMoffjt+s=; b=LE8hRixILbLQiNqs3vQJmNlUrPksFO3lX7GCamoiioqcBPFIGqukFEjuAGx4yNt9mm gqznPPDoNuOIg3xOUzb1Lw5QngG68FQYe/tFAfmfajTB5aFIQsltQOcFxgitWZOCNRRB WZBLtf2xuYk//6CDJfjKL43ih9UrId6E1HUOa4jY0D1amCta+fj2E5dIaQGh5RN/DODC dVhIxe/59hBy9j0rpZpu7vZ5VkQdI0vmAhTovDWON3idPEwwKjYtCSqVA7CnX+ZKjGIQ El7yhF73VLoi0QSV51qZAJW2T+jpY3yx/4hYGJe9od8bYEcljnHWLU7FGLQGicYH/Vxc 0qhg== 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:from:date :message-id:subject:to:cc; bh=JSX7z/QXsqPDJcLZ4mYuVLP5jOPyDEm75mPMoffjt+s=; b=gNJaoc0JAmPD82lDvttNJuBs9LT/roL8nCJHnJFTYrOmDE0nHwYPeYNb6o9yq2lXKa p9loVgATniFL083kpL/YShn3biPZkNEI6kKcmeE2EJvXwiHD0xIpQqdPR27b+i6XBEvd lyKqjK51PoKyHuyVD6jEAxQVIFcwhzvrLoBKrDddwZq6qhfvqQtYcg9SWMOUjXkEAbOU vYlBqk8DdZL2ULwCMQtfWJ4HZUW4VOoOVmic3/Xmpcf867s7oRw2Qd+sB5yfE+ydJFuH HeHthgyf04iIW/WGGe7deq8y3A709QvhxGJo4aBQfHVGM5E5xfXTOZrcqHJtQK05zacq ZZJw== X-Gm-Message-State: AD7BkJKIAnHUVfQFHVZ9Daobk/XTyTVzoACPJOYYBzdfyVS6wsB8PUTnGjbPuJjtVkOii8bx6dh9tc6uR7ab/w== X-Received: by 10.182.24.8 with SMTP id q8mr10856221obf.67.1459138842325; Sun, 27 Mar 2016 21:20:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.19.43 with HTTP; Sun, 27 Mar 2016 21:20:02 -0700 (PDT) In-Reply-To: <2D2C7D68-D59A-407B-B83A-65622DF9CC25@math.nagoya-u.ac.jp> References: <86d1qgqu45.fsf@lpw25.net> <2D2C7D68-D59A-407B-B83A-65622DF9CC25@math.nagoya-u.ac.jp> From: Gregory Malecha Date: Sun, 27 Mar 2016 21:20:02 -0700 Message-ID: To: Jacques Garrigue Cc: Mailing List OCaml Content-Type: multipart/alternative; boundary=001a11c24b38601cf2052f143cf0 Subject: Re: [Caml-list] "Type constructor b would escape its scope" --001a11c24b38601cf2052f143cf0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Thanks. I'm not sure I understand the difference between the two though. Is there an example showing when they produce different results? On Sun, Mar 27, 2016 at 6:12 PM, Jacques Garrigue < garrigue@math.nagoya-u.ac.jp> wrote: > On 2016/03/28 03:52, Gregory Malecha wrote: > > > > Thanks, Leo -- > > > > This is exactly what I needed to know. I thought that the (type a) > annotation was forcing the function to be polymorphic. For future > reference, is there any way to write the annotation (that forces the > function to be polymorphic) without having to write explicit =E2=80=98fun= 's? > > You should either write > > let generic_search_stream : =E2=80=98b. int option -> (internal_result,= =E2=80=98b) > result_stream =3D =E2=80=A6 > > or > > let generic_search_stream : type b. int option -> (internal_result, b) > result_stream =3D =E2=80=A6 > > where the latter one both requires polymorphism and defines a locally > abstract type, > i.e. probably the behavior you expect with (type b). > > Jacques > > --=20 gregory malecha --001a11c24b38601cf2052f143cf0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks. I'm not sure I understand the difference betwe= en the two though. Is there an example showing when they produce different = results?

On = Sun, Mar 27, 2016 at 6:12 PM, Jacques Garrigue <garrigue@math.n= agoya-u.ac.jp> wrote:
On 2016/03/28 03:52, Gregory Malecha wrote:
>
> Thanks, Leo --
>
> This is exactly what I needed to know. I thought that the (type a) ann= otation was forcing the function to be polymorphic. For future reference, i= s there any way to write the annotation (that forces the function to be pol= ymorphic) without having to write explicit =E2=80=98fun's?

You should either write

=C2=A0 let generic_search_stream : =E2=80=98b. int option -> (internal_r= esult, =E2=80=98b) result_stream =3D =E2=80=A6

or

=C2=A0 let generic_search_stream : type b. int option -> (internal_resul= t, b) result_stream =3D =E2=80=A6

where the latter one both requires polymorphism and defines a locally abstr= act type,
i.e. probably the behavior you expect with (type b).

Jacques




--
gregory malecha
--001a11c24b38601cf2052f143cf0--