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 sympa.inria.fr (Postfix) with ESMTPS id 1FAA67EEF8 for ; Fri, 31 Jul 2015 16:33:32 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of marklrh@gmail.com) identity=pra; client-ip=209.85.192.43; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="marklrh@gmail.com"; x-sender="marklrh@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of marklrh@gmail.com designates 209.85.192.43 as permitted sender) identity=mailfrom; client-ip=209.85.192.43; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="marklrh@gmail.com"; x-sender="marklrh@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qg0-f43.google.com) identity=helo; client-ip=209.85.192.43; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="marklrh@gmail.com"; x-sender="postmaster@mail-qg0-f43.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CtAQAAh7tVmyvAVdFbg25aD4MjqSKEOY1ChXkCgTFMAQEBAQEBEgEBAQEBBgsLCSEuhCMBAQEDAQ8BAhEEGQEbEgsBAwELBgUEFAkEHQICDxICEQEFAQoSBhMSEId2AQMKCAMCCKNJgSw+MYpOAQFvgWyCeYsiChknAwpXhFgBAQEBAQEBAQEBAQEBAQEBAQEBAQERAQUOhhGFL4JOgjkHgmmBQwWFZQyHT4cwCAGEeoVjg3iGPYlFhWQ1gRcXhCxPgkwBAQE X-IPAS-Result: A0CtAQAAh7tVmyvAVdFbg25aD4MjqSKEOY1ChXkCgTFMAQEBAQEBEgEBAQEBBgsLCSEuhCMBAQEDAQ8BAhEEGQEbEgsBAwELBgUEFAkEHQICDxICEQEFAQoSBhMSEId2AQMKCAMCCKNJgSw+MYpOAQFvgWyCeYsiChknAwpXhFgBAQEBAQEBAQEBAQEBAQEBAQEBAQERAQUOhhGFL4JOgjkHgmmBQwWFZQyHT4cwCAGEeoVjg3iGPYlFhWQ1gRcXhCxPgkwBAQE X-IronPort-AV: E=Sophos;i="5.15,585,1432591200"; d="scan'208";a="172282647" Received: from mail-qg0-f43.google.com ([209.85.192.43]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 31 Jul 2015 16:33:31 +0200 Received: by qgeh16 with SMTP id h16so46571903qge.3 for ; Fri, 31 Jul 2015 07:33:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:mime-version:message-id:in-reply-to:references:from:to:cc :subject:content-type; bh=I3EUldlMks7pKORGx5rWuwLJUIDHrBlWgLFy8ePsPiY=; b=mWbFA43gGjG8rpdoVlrNRa+1P66EeobpftgAkJimrcFF6plsUyiolOKUQwPpLmfjJN 1bmdDL9+aklsz4zNqAZfV03CH8WFUy1tSkW8LPHvhzQxmiTkt47VGgXecqj8VptwSkAC xHrgHGn5AjjQAsjRpNKtsk/IR6AbAfnR5SR1LwfLxJBi/gfHjWa0u+Wzro9WyEy0dl74 IGEpsODdgejANPO7JUxqD4JiPhd0crV7cxCrvmP5uKwr42s6dE3Xe/Fz50yw6LdYhKMz nY8MJ422ALQICkL0PHJAbjSRAjXdhZxrcNSiJiGOcnszxGDJ9auO52hrdYsCoAZzwkpN Da0g== X-Received: by 10.140.83.84 with SMTP id i78mr4782517qgd.14.1438353210492; Fri, 31 Jul 2015 07:33:30 -0700 (PDT) Received: from hedwig-53.prd.orcali.com (ec2-54-85-253-117.compute-1.amazonaws.com. [54.85.253.117]) by smtp.gmail.com with ESMTPSA id o5sm2290324qko.49.2015.07.31.07.33.29 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jul 2015 07:33:29 -0700 (PDT) Date: Fri, 31 Jul 2015 07:33:29 -0700 (PDT) X-Google-Original-Date: Fri, 31 Jul 2015 14:33:29 GMT MIME-Version: 1.0 X-Mailer: Nodemailer (0.5.0; +http://www.nodemailer.com/) Message-Id: <1438353209392.dc9a8a13@Nodemailer> In-Reply-To: References: X-Orchestra-Oid: 63ACFAC4-DCBB-4077-8A04-D18378E063C6 X-Orchestra-Sig: 054664c698cfdb40776dafdd7af022b5782f98d5 X-Orchestra-Thrid: T2ADADBED-844D-45BD-A8CE-275E3FCAAE5C_1508219845998946078 X-Orchestra-Thrid-Sig: 65ea340607be1699032b332f7072b423ece33512 X-Orchestra-Account: 0b07a14f3c40e18e0979c1c4860b1b6c14a3b8f1 From: "Runhang Li" To: "Ashish Agarwal" Cc: "Carl Eastlund" , "Caml List" Content-Type: multipart/alternative; boundary="----Nodemailer-0.5.0-?=_1-1438353209926" Subject: Re: [Caml-list] selecting GADT parameter ------Nodemailer-0.5.0-?=_1-1438353209926 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi,=C2=A0 I don=E2=80=99t think it is possible.=C2=A0 Suppose you can use only one type constructor. What should be the type of f= unction =E2=80=9Cfun a b -> Foo (a, b)=E2=80=9D? Kindly, Runhang On Fri, Jul 31, 2015 at 3:18 PM, Ashish Agarwal wrote: > You essentially still have 2 constructors, so this isn't quite what I'm > aiming for. > On Fri, Jul 31, 2015 at 9:57 AM, Carl Eastlund > wrote: >> Perhaps like this? (Caveat: I typed this straight into gmail, I haven't >> tried to compile or run this code at all.) >> >> type ('a, 'b, 'c) tag =3D >> | Tag1 : ('a, int, int) tag >> | Tag2 : ('a, string, 'a) tag >> >> type 'a t =3D >> | Foo : ('a, 'b, 'c) tag * 'a * 'b -> 'c t >> >> On Fri, Jul 31, 2015 at 9:48 AM, Ashish Agarwal >> wrote: >> >>> I have: >>> >>> type _ t =3D >>> | Foo1 : 'a * int -> int t >>> | Foo2 : 'a * string -> 'a t >>> >>> but I really want to merge these two cases. I want the return type to be >>> based on the second arg when the second arg is int, and be based on the >>> first arg otherwise. Any way to accomplish that? >>> >>> >> >> >> -- >> Carl Eastlund >> > --=20 > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs= ------Nodemailer-0.5.0-?=_1-1438353209926 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Hi,=C2=A0

I don=E2=80=99t think it is possible.=C2=A0

Suppose you can use only one type constructor. What should be the type= of function =E2=80=9Cfun a b -> Foo (a, b)=E2=80=9D?

Kindly,

Runhang


On Fri, Jul 31, 2015 at 3:18 PM, Ashi= sh Agarwal <agarwal1975@gmail.com> wrote:

You essentially still have 2 constructors, so this isn't q= uite what I'm aiming for.=C2=A0


On Fri, Jul 31, 2015 at 9:57 AM, Carl Eastlu= nd <ceastl= und@janestreet.com> wrote:
Perhaps like this? =C2=A0(Caveat: I typed this straight into gmail, I = haven't tried to compile or run this code at all.)

type ('a, 'b, 'c) tag =3D
| Tag1 : ('a, int, int) tag
| Tag2 : ('a, string, 'a) tag

type 'a t =3D
| Foo : ('a, 'b, 'c) tag * 'a * 'b -> 'c t

On Fri, Jul 31, 2015 at 9:48 AM, Ashish Agar= wal <agarwal1= 975@gmail.com> wrote:
I have:

type _ t =3D
| Foo1 : 'a * int -> int t
| Foo2 : 'a * string -> 'a t

but I really want to merge these two cases. I want the return type to = be based on the second arg when the second arg is int, and be based on the = first arg otherwise. Any way to accomplish that?




--
Carl Eastlund


= ------Nodemailer-0.5.0-?=_1-1438353209926--