From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 23DF3BB86 for ; Fri, 5 May 2006 08:43:05 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k456h4kP028405 for ; Fri, 5 May 2006 08:43:04 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA23404 for ; Fri, 5 May 2006 08:43:04 +0200 (MET DST) Received: from yquem.inria.fr (yquem.inria.fr [128.93.8.37]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k456h3im013828; Fri, 5 May 2006 08:43:03 +0200 Received: by yquem.inria.fr (Postfix, from userid 18041) id 5F327BB86; Fri, 5 May 2006 08:43:03 +0200 (CEST) Date: Fri, 5 May 2006 08:43:03 +0200 To: brogoff Cc: Jeremy Yallop , caml-list@inria.fr Subject: Re: [Caml-list] Oddness with recursive polymorphic variants Message-ID: <20060505064303.GD23421@yquem.inria.fr> References: <445A23BF.4030001@sms.ed.ac.uk> <20060504171010.GB23421@yquem.inria.fr> <445A4ED7.9080900@sms.ed.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i From: luc.maranget@inria.fr (Luc Maranget) X-Miltered: at nez-perce with ID 445AF3F8.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 445AF3F7.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; recursive:01 variants:01 maranget:01 maranget:01 behaves:01 mismatch:01 coerced:01 val:01 --luc:01 luc:01 luc:01 polymorphic:01 caml-list:01 coercion:01 coercion:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 > > I'd like to understand why it behaves differently from the following: > > > > let k (x:f) = (x:g) > > Right, others have shown that you can do what you want with a coercion. The > problem is that you are using exact types ("[" rather than "[>" ) and there > is a mismatch of exact types. ":" is not a coercion, it just tells the type > that should be there. ":>" coerces. x is not of type g, but it can be coerced to > g. > Indeed, # let kk (x:f) = (x :> g);; val kk : f -> g = Thanks, --Luc