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 045BE7EEF8 for ; Fri, 31 Jul 2015 15:57:47 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of ceastlund@janestreet.com) identity=pra; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ceastlund@janestreet.com"; x-sender="ceastlund@janestreet.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of ceastlund@janestreet.com designates 38.105.200.112 as permitted sender) identity=mailfrom; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ceastlund@janestreet.com"; x-sender="ceastlund@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@mxout1.mail.janestreet.com) identity=helo; client-ip=38.105.200.112; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="ceastlund@janestreet.com"; x-sender="postmaster@mxout1.mail.janestreet.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CwAQDDfbtVnHDIaSZbhFcGgx3BFwKBKAdMAQEBAQEBEgEBAQEBBhYJT4QkAQEDARIRBBkBATcBBAsLBAEGNwICIQESAQUBHAYTIod3AwoIA6M1gSw+MYpPcIRlAQWLaQ2FLwEBAQEBAQQBAQEBAQEBARQGCotEgk6COQeCaYFDlH2KXoFrkg+FZBIjgRcXhChTgkwBAQE X-IPAS-Result: A0CwAQDDfbtVnHDIaSZbhFcGgx3BFwKBKAdMAQEBAQEBEgEBAQEBBhYJT4QkAQEDARIRBBkBATcBBAsLBAEGNwICIQESAQUBHAYTIod3AwoIA6M1gSw+MYpPcIRlAQWLaQ2FLwEBAQEBAQQBAQEBAQEBARQGCotEgk6COQeCaYFDlH2KXoFrkg+FZBIjgRcXhChTgkwBAQE X-IronPort-AV: E=Sophos;i="5.15,584,1432591200"; d="scan'208";a="141705617" Received: from mxout1.mail.janestreet.com ([38.105.200.112]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 31 Jul 2015 15:57:46 +0200 Received: from tot-qpr-mailcore2.delacy.com ([172.27.56.106] helo=tot-qpr-mailcore2) by mxout1.mail.janestreet.com with esmtps (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.82) (envelope-from ) id 1ZLAoi-0002C0-Pn for caml-list@inria.fr; Fri, 31 Jul 2015 09:57:44 -0400 X-JS-Flow: external Received: by tot-qpr-mailcore2 with JS-mailcore (0.1) (envelope-from ) id BVu37Y-AAAGvJ-Xj; 2015-07-31 09:57:44.754637-04:00 Received: from mail-ig0-f180.google.com ([209.85.213.180]) by mxgoog1.mail.janestreet.com with esmtps (UNKNOWN:AES128-GCM-SHA256:128) (Exim 4.72) (envelope-from ) id 1ZLAoi-0000HS-M7 for caml-list@inria.fr; Fri, 31 Jul 2015 09:57:44 -0400 Received: by igr7 with SMTP id 7so16866519igr.0 for ; Fri, 31 Jul 2015 06:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=4inneEwhJg5uDJzygCzmsK7Xs93PyrQXw01EhPWTnik=; b=MRXFI8GvRNKEANdCZb8jMw8W18hINyHqPym47PBF9VYoHjV4oOvffRsPWczAAyGkjZ dw9vt7rdHhgm3jycHIfbJQcMmaIpkpCdF0265ApZBT4AvNOhw2ORv4ieezST1haJ+2bc FFicoXosDPLBxG04KlxhN93pA80CRCh5m8mbg= 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:content-type; bh=4inneEwhJg5uDJzygCzmsK7Xs93PyrQXw01EhPWTnik=; b=AIR8CKIU5B8Wr1taC84+eO9iJydxlvsXLwLirxg2XdE3ppS8WROuQ0yoX1QzxL1T+w VPh6AcmBBigI02/7QhTuBkRAsZ25BqGt3dTumij7qmTjfyKPYozfGwcOUUjJD8R4PcTd xqu6epk7aFVYQ+NW0bZV7+t9rfAK6q+5wYD9qC9llhtS0+ZHBJxi5sOGbFEIK2Kcf7tQ UaS7OpoTxn5Mit4Q8jutTYjfNPURo/gXqQlzJSXRgjyYXDnKDGO0pcGMvUD3wBJ6N24b F7Dg/vNxPWRDZ8ncUnJRFtqACL1RyJ7RC6ysrWs6Bkh5nfJ/ixaxonK1BKd7mFo5o/4A 86ZA== X-Gm-Message-State: ALoCoQnHXnBlaNpTBCNe1RkAAeJdgZ5eNVat1J10+HeiwaGfD5BoU9GiV5mMBEgcs0fqRGgwQACjDiEphapbRmw9ZJcyamNPdPKRGidgdWbsPzFIPWghJHwiihDmlhog8sSw/RMvqApw X-Received: by 10.50.2.9 with SMTP id 9mr5647082igq.42.1438351064362; Fri, 31 Jul 2015 06:57:44 -0700 (PDT) X-Received: by 10.50.2.9 with SMTP id 9mr5647069igq.42.1438351064280; Fri, 31 Jul 2015 06:57:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.136.26 with HTTP; Fri, 31 Jul 2015 06:57:04 -0700 (PDT) In-Reply-To: References: From:Carl Eastlund Date: Fri, 31 Jul 2015 09:57:04 -0400 Message-ID: To:Ashish Agarwal Cc:Caml List Content-Type: multipart/alternative; boundary=089e011837b03fd1de051c2c34b8 X-JS-Processed-by: mailcore Subject: Re: [Caml-list] selecting GADT parameter --089e011837b03fd1de051c2c34b8 Content-Type: text/plain; charset=UTF-8 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 = | Tag1 : ('a, int, int) tag | Tag2 : ('a, string, 'a) tag type 'a t = | 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 = > | 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 --089e011837b03fd1de051c2c34b8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Perhaps like this? =C2=A0(Caveat: I typed this straig= ht 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
<= br>
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 <agarwal1975@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 t= wo cases. I want the return type to be based on the second arg when the sec= ond arg is int, and be based on the first arg otherwise. Any way to accompl= ish that?




--
Carl Eastlund
--089e011837b03fd1de051c2c34b8--