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 LAA10484; Thu, 7 Feb 2002 11:09:20 +0100 (MET) 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 LAA31432 for ; Thu, 7 Feb 2002 11:09:19 +0100 (MET) Received: from paille.inria.fr (paille.inria.fr [128.93.11.15]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g17A9J900564 for ; Thu, 7 Feb 2002 11:09:19 +0100 (MET) Received: (from hirschow@localhost) by paille.inria.fr (8.11.6/8.11.6) id g17A4M414698; Thu, 7 Feb 2002 11:04:22 +0100 X-Authentication-Warning: paille.inria.fr: hirschow set sender to Tom.Hirschowitz@inria.fr using -f From: Tom Hirschowitz MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15458.20773.964917.531200@paille.inria.fr> Date: Thu, 7 Feb 2002 11:04:21 +0100 To: Alain Frisch , Jonathan D Eddy , Subject: Re: [Caml-list] Odd Type Checking Problem In-Reply-To: <15458.19627.196922.659055@paille.inria.fr> References: <15458.19627.196922.659055@paille.inria.fr> X-Mailer: VM 6.97 under Emacs 20.7.1 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Ok it is something else, just that the expression let mAny = fun succ0 input -> succ0 in let x = mAny (mAny true) in mAny is expansive and therefore cannot be generalized in, say let h = let mAny = fun succ0 input -> succ0 in let x = mAny (mAny true) in mAny in ... Tom Hirschowitz writes: > > What about these ones : > > # let mAny = fun succ0 input -> succ0 in > let x = mAny (mAny true) in > mAny;; > - : '_a -> '_b -> '_a = > > # let mAny = fun succ0 input -> succ0 in > mAny;; > - : 'a -> 'b -> 'a = > > > Alain Frisch writes: > > 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 > > > ------------------- > 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 > ------------------- 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