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.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 186D0BBC1 for ; Tue, 19 Feb 2008 13:38:40 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAMNcukeBrw8EW2dsb2JhbACQQxUKKp0m X-IronPort-AV: E=Sophos;i="4.25,376,1199660400"; d="scan'208";a="22785734" Received: from discorde.inria.fr ([192.93.2.38]) by mail4-smtp-sop.national.inria.fr with ESMTP; 19 Feb 2008 13:38:40 +0100 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m1JCcd4e014908 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Tue, 19 Feb 2008 13:38:39 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAMNcukeBrw8EW2dsb2JhbACQQxUKKp0m X-IronPort-AV: E=Sophos;i="4.25,376,1199660400"; d="scan'208";a="22785732" Received: from ext.lri.fr ([129.175.15.4]) by mail4-smtp-sop.national.inria.fr with ESMTP; 19 Feb 2008 13:38:39 +0100 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id 0316CA45F4 for ; Tue, 19 Feb 2008 13:38:39 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lri.fr Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oOFmRaKITSdg for ; Tue, 19 Feb 2008 13:38:38 +0100 (CET) Received: from smtp.lri.fr (vhost3-23 [129.175.3.23]) by ext.lri.fr (Postfix) with ESMTP id D78A3A43F8 for ; Tue, 19 Feb 2008 13:38:38 +0100 (CET) Received: from serveur9-10.lri.fr (serveur9-10 [129.175.9.10]) by smtp.lri.fr (Postfix) with ESMTP id C7BE2E0532; Tue, 19 Feb 2008 13:38:38 +0100 (CET) Received: from localhost ([127.0.0.1] ident=signoles) by serveur9-10.lri.fr with esmtp (Exim 3.36 #1 (Debian)) id 1JRRk6-0006CZ-00; Tue, 19 Feb 2008 13:38:38 +0100 Date: Tue, 19 Feb 2008 13:38:38 +0100 (CET) From: Julien Signoles To: Johannes Kanig Cc: caml-list@inria.fr Subject: Re: [Caml-list] polymorphic variants and promotion In-Reply-To: <926565e50802190223r456d0ec2we4b8a4f51b134f42@mail.gmail.com> Message-ID: References: <926565e50802190223r456d0ec2we4b8a4f51b134f42@mail.gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Miltered: at discorde with ID 47BACDCF.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; signoles:01 signoles:01 lri:01 variants:01 polymorphic:01 caml-list:01 coercion:01 int:01 int:01 julien:12 julien:12 does:14 use:16 hello:17 possible:17 Hello Johannes, > What I don't understand is why the promotion of [`A of int] to [> `A of int] > is not possible in general: > > # `A 1;; > - : [> `A of int ] = `A 1 > # (`A 1 : [`A of int]) ;; > - : [ `A of int ] = `A 1 > # ((`A 1 : [`A of int]) : [> `A of int]) ;; > - : [ `A of int ] = `A 1 > > Does anyone have an answer? You have to use coercion in order to promote: # (`A 1 : [ `A of int ] :> [> `A of int ]);; - : [> `A of int ] = `A 1 -- Julien