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 CAA01716; Wed, 19 Sep 2001 02:06:01 +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 CAA01754 for ; Wed, 19 Sep 2001 02:06:00 +0200 (MET DST) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f8J05xL06909 for ; Wed, 19 Sep 2001 02:05:59 +0200 (MET DST) Received: from localhost (patrick@localhost) by fledge.watson.org (8.11.6/8.11.5) with SMTP id f8J05lE86463 for ; Tue, 18 Sep 2001 20:05:47 -0400 (EDT) (envelope-from patrick@watson.org) Date: Tue, 18 Sep 2001 20:05:46 -0400 (EDT) From: Patrick M Doane To: caml-list@inria.fr Subject: Re: [Caml-list] Polymorphic variant abbreviations In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk The last 2 questions were about possible minor improvements with using abbreviations. Now I'm stumped - can anyone bail me out? (* Some type definitions and abbreviations *) type t = ([ `A of 'a list | `B | `C ]) as 'a type b = [ `B ] type c = [ `C ] (* A rename for one of the abbreviations *) type b2 = b (* Use of abbreviation and rename work okay *) let f1 (#b as x1) (#b as x2) = `A [x1;x2] let f2 (#b2 as x1) (#b2 as x2) = `A [x1;x2] (* Only direct abbreviation works with list constructor *) let g1 ~(xs : #b list) = `A xs (* this doesn't compile - says unbound class b2 let g2 ~(xs : #b2 list) = `A xs *) (* The first works as I would expect, the second gives a very unexpected type. There seems to be some kind of unexpected unification going on between terms. *) let h1 (#b as x1) (#c as x2) = `A [x1; x2] let h2 (x1 : #b) (x2 : #c) = `A [x1; x2] Any ideas? Thanks, Patrick ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr