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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id A26327EEBF for ; Wed, 5 Aug 2015 19:27:01 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of agarwal1975@gmail.com) identity=pra; client-ip=209.85.212.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="agarwal1975@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of agarwal1975@gmail.com designates 209.85.212.172 as permitted sender) identity=mailfrom; client-ip=209.85.212.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="agarwal1975@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-wi0-f172.google.com) identity=helo; client-ip=209.85.212.172; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="agarwal1975@gmail.com"; x-sender="postmaster@mail-wi0-f172.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0ATAwBARsJVm6zUVdFbg29pBoMdqVuEX4p9gjeFeQKBQQdMAQEBAQEBEgEBAQEBBgsLCSEuhCMBAQEDARIRBBkBGxILAQMBCwYDAgQHDQ0dAgIiAREBBQEKEgYTEhCHdgEDCggNmTOPP4EuPjGLP4FsgnmLTwoZJwMKFUKEWwEBAQEBAQQBAQEBAQEBARQBBQ6LQYUFBAeCaYFDBYVoDI8FBoR/h1eCDZYNEiOBFxEGhCgiMYJMAQEB X-IPAS-Result: A0ATAwBARsJVm6zUVdFbg29pBoMdqVuEX4p9gjeFeQKBQQdMAQEBAQEBEgEBAQEBBgsLCSEuhCMBAQEDARIRBBkBGxILAQMBCwYDAgQHDQ0dAgIiAREBBQEKEgYTEhCHdgEDCggNmTOPP4EuPjGLP4FsgnmLTwoZJwMKFUKEWwEBAQEBAQQBAQEBAQEBARQBBQ6LQYUFBAeCaYFDBYVoDI8FBoR/h1eCDZYNEiOBFxEGhCgiMYJMAQEB X-IronPort-AV: E=Sophos;i="5.15,618,1432591200"; d="scan'208";a="172777310" Received: from mail-wi0-f172.google.com ([209.85.212.172]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 05 Aug 2015 19:27:01 +0200 Received: by wibhh20 with SMTP id hh20so34247980wib.0 for ; Wed, 05 Aug 2015 10:27:01 -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:content-type; bh=LeU7LSOzi5/64tKrFOH/GZwGhVC65qiNBQJ05aTJMzE=; b=rEJHMT/nlM1bCZ6mRm2b3cKahAyAunYErdZnbv/T7FnGVRLmYcFrnwAJThXB8xMzoP imLY+CwCl45ejJxOxRdwJkThtylPdKVRK54A3I41Hh2uhPZGBfJKY73ntYLjwq1pKNzO FSKe6RhZ3RT0IOY3aMrMaF/ReI30B01u8CjuJEjnFQZb98pd6ZVYnh/21u94HJqOgcb/ +g/4Cq3W8sHcpwcG5OXEBbN2a3FA04VRx7drESYnaf4jWpT0ItMOO/l4ao5Jx2iQBdQd 2kEwsawxdRhtAYCwK5+1lxe7m4GHjoedZOpMAVbY+FVzso0v4LPYerTqk19wWepDSfm5 vp4Q== X-Received: by 10.180.198.48 with SMTP id iz16mr571731wic.47.1438795620999; Wed, 05 Aug 2015 10:27:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.27.82.86 with HTTP; Wed, 5 Aug 2015 10:26:41 -0700 (PDT) In-Reply-To: <20150804092129.GB5689@frosties> References: <20150804092129.GB5689@frosties> From: Ashish Agarwal Date: Wed, 5 Aug 2015 13:26:41 -0400 Message-ID: To: Goswin von Brederlow Cc: Caml List Content-Type: multipart/alternative; boundary=047d7b624e6ce4e724051c93b584 Subject: Re: [Caml-list] selecting GADT parameter --047d7b624e6ce4e724051c93b584 Content-Type: text/plain; charset=UTF-8 Thanks for the answers. I see now the difficulty in this. (Though it seems possible in theory if we required type annotations in various places.) On Tue, Aug 4, 2015 at 5:21 AM, Goswin von Brederlow wrote: > On Fri, Jul 31, 2015 at 09:48:13AM -0400, 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? > > Say you had (imaginary syntax): > > type _ t = > | Foo : 'a * int -> int t > | Foo : 'a * string -> 'a t > > let x1 = Foo (1, 1) : int t > let x2 = Foo (1, "x") : int t > > match (x : int t) with > | Foo (a, b) -> ... > > What is the type of (a, b) now? Is it (int, int) or (int, string)? > > MfG > Goswin > > -- > 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 > --047d7b624e6ce4e724051c93b584 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks for the answers. I see now the difficulty in this. = (Though it seems possible in theory if we required type annotations in vari= ous places.)
--047d7b624e6ce4e724051c93b584--