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 RAA25485; Mon, 16 Jul 2001 17:51:33 +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 RAA25457 for ; Mon, 16 Jul 2001 17:51:32 +0200 (MET DST) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f6GFpVT05242 for ; Mon, 16 Jul 2001 17:51:32 +0200 (MET DST) Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22]) by nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id f6GFpVm18450 ; Mon, 16 Jul 2001 17:51:31 +0200 (CEST) Received: from localhost (frisch@localhost) by clipper.ens.fr (8.9.2/jb-1.1) id RAA16945 ; Mon, 16 Jul 2001 17:51:31 +0200 (MET DST) Date: Mon, 16 Jul 2001 17:51:31 +0200 (MET DST) From: Alain Frisch To: Rolf Wester cc: caml-list@inria.fr Subject: Re: [Caml-list] Sample code doesn't work In-Reply-To: <3B5327AF.24111.5E50BF6@localhost> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 16 Jul 2001, Rolf Wester wrote: > let rec make_account wert0 = > let wert = wert0 in > let add wert_ = > make_account (wert+.wert_) > in > let sub wert_ = > make_account (wert-.wert_) > in > let get () = > wert > in > (add, sub, get);; > > When trying to evaluate this I get the error message: > > This expression has type > (float -> 'a * 'b * 'c) * (float -> 'a * 'b * 'c) * (unit -> float) > but is here used with type 'a * 'b * 'c > > How can I make this work? You need recursive types to be able to unify these two type expressions. It is often the case when you want, as in this example, simulate the object paradigm. Just add the -rectypes switch to the toplevel/compiler command line. -- Alain Frisch ------------------- 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