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 VAA23579; Wed, 19 Sep 2001 21:06:32 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 VAA21904 for ; Wed, 19 Sep 2001 21:06:31 +0200 (MET DST) Received: from mta05-svc.ntlworld.com (mta05-svc.ntlworld.com [62.253.162.45]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8JJ6UX15249 for ; Wed, 19 Sep 2001 21:06:30 +0200 (MET DST) Received: from htec.demon.co.uk ([62.252.181.3]) by mta05-svc.ntlworld.com (InterMail vM.4.01.03.00 201-229-121) with ESMTP id <20010919190625.UUOI20588.mta05-svc.ntlworld.com@htec.demon.co.uk>; Wed, 19 Sep 2001 20:06:25 +0100 Message-ID: <3BA8ED93.1D80A49E@htec.demon.co.uk> Date: Wed, 19 Sep 2001 20:10:11 +0100 From: Chris Quinn X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.4.0-test6 i686) X-Accept-Language: en MIME-Version: 1.0 To: Matteo Frigo CC: caml-list@inria.fr Subject: Re: [Caml-list] Problem with polymorphic letrec References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > let rec polymul mul p q = > polymul (polymul mul) (fun _ -> p) (fun _ -> q) > > This expression does not typecheck in ocaml 2 because polymul is used > polymorphically within its own body. > > I could not come up with any hack to code polymul without changing the > representation of polynomials, which I'd rather not change for other > reasons. > > Any suggestion on how to work around this problem? You can certainly get the polymorphism back by abstracting out the main functionality: let rec polymul_aux f mul p q = f (f mul) (fun _ -> p) (fun _ -> q) then : let polymul = polymul_aux polymul_f But maybe, ultimately, that will not be the problem! I don't know if it has any relevance at all but the -rectypes flag can sometimes help. For instance: type key type 'data map = (key * ('data * 'data map)) list This is a type which will not typecheck without -rectypes but it is definitely meaningful and useful to me! Chris Q. ------------------- 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