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 XAA20421; Wed, 6 Feb 2002 23:59:36 +0100 (MET) 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 XAA19971 for ; Wed, 6 Feb 2002 23:59:35 +0100 (MET) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g16MxYT19198 for ; Wed, 6 Feb 2002 23:59:34 +0100 (MET) 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 g16MxYp64042 ; Wed, 6 Feb 2002 23:59:34 +0100 (CET) Received: from localhost (frisch@localhost) by clipper.ens.fr (8.9.2/jb-1.1) id XAA02533 ; Wed, 6 Feb 2002 23:59:34 +0100 (MET) Date: Wed, 6 Feb 2002 23:59:34 +0100 (MET) From: Alain Frisch To: Jonathan D Eddy cc: Subject: Re: [Caml-list] Odd Type Checking Problem 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 On Wed, 6 Feb 2002, Jonathan D Eddy wrote: > (* type checks *) > let mAny = fun succ0 input -> succ0 in > let ans0 = true in > let x = mAny (mAny ans0) in > x 1 2 > > (* does not type check *) > let mAny: 'a -> int -> 'a = fun succ0 input -> succ0 in > let ans0 = true in > let x = mAny (mAny ans0) in > x 1 2 I guess this is a problem of understanding type variable scoping rules. The scope of the 'a variable above is all the phrase, including the (mAny (mAny ans0)). So the type annotation makes mAny monomorphic, but you want to use it with two different types. It seems that explicitly introduced type variables are generalized only at the (syntactic) level above their introduction; this together with unclear scoping rules may be confusing ... -- Alain ------------------- 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