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 BAA12058; Fri, 25 Jun 2004 01:20:50 +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 BAA12458 for ; Fri, 25 Jun 2004 01:20:49 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i5ONKmEV026133 for ; Fri, 25 Jun 2004 01:20:48 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.11.6/8.10.1) with ESMTP id i5ONKji13606; Thu, 24 Jun 2004 18:20:45 -0500 (CDT) Date: Thu, 24 Jun 2004 18:26:41 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: John Hughes cc: "'caml-list'" Subject: RE: [Caml-list] Why must types be always defined at the top level? In-Reply-To: <20040624194603.2A91010EF06@clark.cs.brown.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 40DB61D0.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 annotates:01 parens:01 val:01 bool:01 int:01 int:01 wrote:03 bind:03 types:03 types:03 redirect:95 let:04 let:04 brian:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 24 Jun 2004, John Hughes wrote: > I have one more question, though: > > 5. Why can I no longer type-annotate things I've written, so that > > let f x y z = (x = y) & (y = z) > > defines a function applicable to ALL types? I actually *liked* > being able to say something like > > let f x y z:int = (x = y) && (y = z) This annotates that f returns an int. You need to use parens to make the :int bind to z and not to f. This works: # let f x y (z:int) = (x = y) && (y = z);; val f : int -> int -> int -> bool = # This is another one of those shift-reduce conflicts that annoy me. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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