From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA04491 for caml-red; Sat, 25 Nov 2000 16:55:12 +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 XAA03941 for ; Thu, 23 Nov 2000 23:25:37 +0100 (MET) Received: from tor.abc.se (ns.abc.se [195.17.72.11]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id eANMPab18514 for ; Thu, 23 Nov 2000 23:25:36 +0100 (MET) Received: from gateway (dialup-16 [195.17.73.16]) by tor.abc.se (8.9.3+Sun/8.9.3) with SMTP id XAA25072 for ; Thu, 23 Nov 2000 23:25:34 +0100 (MET) From: "Mattias Waldau" To: Subject: Typing the result of a function Date: Thu, 23 Nov 2000 23:25:32 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal In-Reply-To: <20001123135625.A19531@lambda.u-strasbg.fr> Sender: weis@pauillac.inria.fr I know how to type the arguments, and I like to do it, since I will get the compile errors directly, not first when I use the function. Thus, I typical write a function like (* return the column called name *) let find (columns:columns) (name:column_type) = List.find ( fun column -> column.data_type = name ) columns.columns which has typing val find : columns -> column_type -> column = If I use the interactive environment, I see that I get the expected result column. I needed to see this, since this is my first use of List.find, and I wanted to be sure that it returned the column. However, I would have liked to say this already in the definition of find, that the result of my function find should be a column. How is this done? /mattias P.s. I like to type, since I think it is belongs to the documentation of the code. P.P.s. How to type arguments is not very well described in the documentation. I found one example, twice.