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 RAA05781; Thu, 3 Apr 2003 17:04:12 +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 RAA05448 for ; Thu, 3 Apr 2003 17:04:11 +0200 (MET DST) Received: from pelops.inria.fr (pelops.inria.fr [128.93.24.69]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h33F44902221; Thu, 3 Apr 2003 17:04:04 +0200 (MET DST) Received: from pelops.inria.fr (localhost [127.0.0.1]) by pelops.inria.fr (8.11.1/8.11.1) with ESMTP id h33F44Y23671; Thu, 3 Apr 2003 17:04:04 +0200 Message-Id: <200304031504.h33F44Y23671@pelops.inria.fr> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Francois Rouaix cc: caml-list@inria.fr Subject: Re: [Caml-list] mystified by typing of optional arguments In-Reply-To: Message from Francois Rouaix of "Thu, 03 Apr 2003 16:50:44 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 03 Apr 2003 17:04:04 +0200 From: Francois Thomasset X-Spam: no; 0.00; caml-list:01 typable:01 int:01 match:02 typing:03 arguments:03 let:04 type:07 function:09 opt:09 expression:13 inria:15 but:16 thomasset:82 why:17 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Hi all, > The following example mystifies me > > let f ?opt x = > match opt with > | None -> x > | Some dx -> x + dx > > let g x = x + 1 > > > let h1 = function > | 0 -> [g] > | _ -> [f; g] > > > let h2 = function > | _ -> [f; g] > > > h1 is typable but not h2. > Why is that ? You cant' type [f;g] either ! # [ f ; g ];; This expression has type int -> int but is here used with type ?opt:int -> int -> int While [g;g] is a list of funs FT ------------------- 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