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 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 9FF74BC69 for ; Tue, 4 Dec 2007 15:33:20 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAOvzVEeGnQCBnmdsb2JhbACPTgEBAQcEBik X-IronPort-AV: E=Sophos;i="4.23,248,1194217200"; d="scan'208";a="19968566" Received: from shiva.jussieu.fr ([134.157.0.129]) by mail4-smtp-sop.national.inria.fr with ESMTP; 04 Dec 2007 15:33:20 +0100 Received: from hydrogene.pps.jussieu.fr (hydrogene.pps.jussieu.fr [134.157.168.1]) by shiva.jussieu.fr (8.13.8/jtpda-5.4) with ESMTP id lB4EX2qt091869 ; Tue, 4 Dec 2007 15:33:02 +0100 (CET) X-Ids: 168 Received: from [134.157.168.28] (glondu@nickel.pps.jussieu.fr [134.157.168.28]) by hydrogene.pps.jussieu.fr (8.13.4/jtpda-5.4) with ESMTP id lB4EX0bN008812 ; Tue, 4 Dec 2007 15:33:01 +0100 Message-ID: <4755651C.5010407@glondu.net> Date: Tue, 04 Dec 2007 15:33:00 +0100 From: Stephane Glondu User-Agent: Mozilla-Thunderbird 2.0.0.6 (X11/20071009) MIME-Version: 1.0 To: Jacques Garrigue Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Union of polymorphic variants... References: <47554A47.0@glondu.net> <20071204.225712.186423247.garrigue@math.nagoya-u.ac.jp> In-Reply-To: <20071204.225712.186423247.garrigue@math.nagoya-u.ac.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (shiva.jussieu.fr [134.157.0.168]); Tue, 04 Dec 2007 15:33:02 +0100 (CET) X-Virus-Scanned: ClamAV 0.88.7/4993/Tue Dec 4 14:09:42 2007 on shiva.jussieu.fr X-Virus-Status: Clean X-Miltered: at shiva.jussieu.fr with ID 4755651E.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; variants:01 variants:01 ocamlduce:01 steph:98 polymorphic:01 polymorphic:01 caml-list:01 constructor:01 variant:02 garrigue:03 jacques:03 dispatch:03 parameters:03 let:03 let:03 Jacques Garrigue a écrit : > [...] union of polymorphic variant is flat [...] > The reason is that dispatch only looks at the head constructor: > > let f = function > | #b as x -> fb x > | #c as x -> fc x > [...] Actually, I was faced to the problem in a similar pattern-matching, and I reduced the problem to the example in my post :-) > [...] is actually > > let f = function > | `A _ as x -> fb x > | `A _ as x -> fc x > > which only types if both parameters have the same type. However, one can do: let f = function | `A (`B _) -> ... | `A (`C _) -> .. Would it be difficult to extend the system so that #b and #c expand to the constructions above? > Polymorphic variants are _not_ XML types. > Use ocamlduce for that :-) I am having a look at it... -- Stéphane Glondu