From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 85007BBB8 for ; Mon, 2 Feb 2009 18:07:44 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmEDAAO3hklDww+pmWdsb2JhbACPBYUSAQEBAQEICwoHEaljgSwIjDMFAgGCVwiBMgY X-IronPort-AV: E=Sophos;i="4.37,366,1231110000"; d="scan'208";a="20524818" Received: from web111507.mail.gq1.yahoo.com ([67.195.15.169]) by mail2-smtp-roc.national.inria.fr with SMTP; 02 Feb 2009 18:07:43 +0100 Received: (qmail 29182 invoked by uid 60001); 2 Feb 2009 17:07:41 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=gP3xwgdKPSd971Da8RFl0aVNxqqTs6/fUr07tE1Vf7TPBsi9pyLRWWW5LAKMD6Kv4rIe949HMEOKfig/uOL14z7Lkex+ZgUHHq3xMujmrY6FTRA8GhF1jgag9mX6DJb2QbKLcPzLrU7ZQTMtB7QiDdmI3mGXWv3vTuZi1LOvIls=; X-YMail-OSG: qlSJtXMVM1mR2VlxqnGlK3cGAFp7YYmosM5g.WOfwttLYkgnO9o- Received: from [213.205.70.219] by web111507.mail.gq1.yahoo.com via HTTP; Mon, 02 Feb 2009 09:07:41 PST X-Mailer: YahooMailWebService/0.7.260.1 Date: Mon, 2 Feb 2009 09:07:41 -0800 (PST) From: Dario Teixeira Subject: Re: [Caml-list] Union of type variables To: caml-list@yquem.inria.fr In-Reply-To: <725185.7305.qm@web111505.mail.gq1.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-ID: <778474.28487.qm@web111507.mail.gq1.yahoo.com> X-Spam: no; 0.00; kludge:01 presupposes:01 variants:01 val:01 variants:01 val:01 cheers:01 polymorphic:01 polymorphic:01 caml-list:01 variables:02 variables:02 let:03 let:03 meantime:05 Hi, > Obviously I would like to get rid of this kludge. The signature and > implementation for "union" should be something like the (syntactically > incorrect) code below. But is it at all possible to declare an union > of type variables? (which presupposes they are polymorphic variants) >=20 > val union: 'x t -> 'y t -> [> 'x | > 'y ] t > let union x y =3D Union (x, y) In the meantime I realised what the problem was. I neglected to take into account the open nature of polymorphic variants, meaning that as long as the phantom type variable is open, then the following code is enough to do what I want: val union: 'a t -> 'a t -> 'a t let union x y =3D Union (x, y) Cheers, Dario Teixeira =0A=0A=0A