From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA13238; Thu, 29 Apr 2004 20:09:56 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA13236 for ; Thu, 29 Apr 2004 20:09:54 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i3TI9pEV022196 for ; Thu, 29 Apr 2004 20:09:52 +0200 Received: from [192.168.1.200] (ppp119-197.lns1.syd2.internode.on.net [150.101.119.197]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i3TI9kk2080975; Fri, 30 Apr 2004 03:39:48 +0930 (CST) Subject: Re: [Caml-list] Documentation error - #myvariant From: skaller Reply-To: skaller@users.sourceforge.net To: Remi Vanicat Cc: caml-list In-Reply-To: <8765bjvtx6.dlv@vanicat.homelinux.org> References: <8765bjvtx6.dlv@vanicat.homelinux.org> Content-Type: text/plain Message-Id: <1083262171.9537.1395.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 30 Apr 2004 04:09:45 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 409144EF.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 9660:01 glebe:01 nsw:01 remi:01 vanicat:01 polymorphic:01 snail:02 checkout:02 2037:03 wrote:03 recursive:03 define:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 2004-04-29 at 22:40, Remi Vanicat wrote: > > But this is not correct! Consider > > > > type de = [`D | `E of de];; > > > > type def = [`D | `E of def | `F of def];; > In fact, your code will do what you want if you don't define your type > as recursive but as polymorphic : > > type 'a de = [`D | `E of 'a];; > > type 'a def = [`D | `E of 'a | `F of 'a];; type 'a de' = [`D | `E of 'a] type 'a def' = ['a de' | `F of 'a] type de = 'a de' as 'a type def = 'a def' as 'a -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners