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 CAA20812; Mon, 25 Aug 2003 02:30:58 +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 CAA13309 for ; Mon, 25 Aug 2003 02:30:57 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h7P0UtT18384 for ; Mon, 25 Aug 2003 02:30:56 +0200 (MET DST) Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3p2/3.7W) with ESMTP id JAA28109; Mon, 25 Aug 2003 09:30:49 +0900 (JST) To: l_stafiniak@hoga.pl Cc: caml-list@inria.fr Subject: Re: [Caml-list] Polymorphic recursion In-Reply-To: <002c01c36a6a$05ba9f20$aaee4dd5@ppp> References: <002c01c36a6a$05ba9f20$aaee4dd5@ppp> X-Mailer: Mew version 1.94.2 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20030825093049F.garrigue@kurims.kyoto-u.ac.jp> Date: Mon, 25 Aug 2003 09:30:49 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 recursion:01 jacques:01 lukasz:01 recursion:01 evidently:01 ventured:99 typecheck:01 420:99 checker:01 jacques:01 ocaml:01 mutable:01 garrigue:01 garrigue:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: "Lukasz Stafiniak" > I have recently encountered some very interesting notions (cited below). > Although I've been using OCaml for some time, up to now I didn't know about > the existence of polymorphic records and (their reference to) the problem of > polymorphic recursion. Perhaps a word about it should be stated in the > manual (more evidently)? (I don't even recall to have seen the syntax in the > manual for this.) It is in the tutorial, but maybe confusingly under "mutable fields". > With Your help I ventured again to "typecheck my programs before they are > generated" etc. But now I get an error I totally don't understand. (Still it > somehow resembles the problem it posed as an ordinary function.) Could > someone explain? I have attached the file. The error message I get is: File "typedcode.ml", line 55, characters 2-420: This field value has type 'a annot annot valu_env option -> 'a annot valu -> 'a annot valu_env which is less general than 'b. 'b valu_env option -> 'b valu -> 'b valu_env Which just means that since 'a annot is not a type variable, it is less general than valu. Actually, it seems that the type checker is overly restrictive, as you have defined type 'a annot = 'a Note that such definitions make lots of thing more difficult, and I am starting to desespair to handle them fully correctly: they make it impossible to assume that 'a annot is really not a type variable. I'll try to fix it anyway. Jacques Garrigue ------------------- 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