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 LAA03755; Fri, 13 Aug 2004 11:02:14 +0200 (MET DST) 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 LAA02259 for ; Fri, 13 Aug 2004 11:02:13 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i7D92CmL020500 for ; Fri, 13 Aug 2004 11:02:12 +0200 Received: from ibm3.cicrp.jussieu.fr (ibm3.cicrp.jussieu.fr [134.157.15.3]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id i7D925V4011448 ; Fri, 13 Aug 2004 11:02:06 +0200 (CEST) X-Ids: 165 Received: from ibm1.cicrp.jussieu.fr (ibm1.cicrp.jussieu.fr [134.157.15.1]) by ibm3.cicrp.jussieu.fr (8.8.8/jtpda/mob-V8) with ESMTP id LAA131808 ; Fri, 13 Aug 2004 11:00:08 +0200 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda/mob-v8) with ESMTP id KAA655600 ; Fri, 13 Aug 2004 10:59:47 +0200 X-Authentication-Warning: ibm1.cicrp.jussieu.fr: fernande owned process doing -bs Date: Fri, 13 Aug 2004 10:59:46 +0200 (DST) From: Diego Olivier Fernandez Pons X-X-Sender: fernande@ibm1 To: Jean-Baptiste Rouquier cc: caml-list@inria.fr Subject: Re: [Caml-list] getting the type of a polymorphic data ? In-Reply-To: <1092334731.411bb48b56f4e@mouette.ens-lyon.fr> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 411C8394.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 411C838D.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pons:01 pons:01 etu:99 caml-list:01 val:01 printf:01 printf:01 val:01 fernandez:01 fernandez:01 int:01 int:01 polymorphic:01 olivier:02 olivier:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bonjour, > # type 'a result = 'a * string;; > # let new_result (a:'a) description = ((a,description) : 'a result);; > val new_result : 'a -> string -> 'a result = > # let print_int ((a,d): int result) = Printf.printf "%s is %d\n%!" d a;; > val print_int : int result -> unit = > # let print_float = ... > # let x = new_result 10 "the number of elements in the knapsack";; > val x : int result = ... > # print_int x;; > the number of elements in the knapsack is 10 > - : unit = () Here is the problem of this approach # let complex_computation = fun x y -> x + y val complex_computation : int -> int -> int = let x = simple_computation () and y = simple_computation () let z = complex_computation x y Now I what to add a comment to x to print intermediate results and check the first computation is correct. In your approach, this lifts x : int on x : int result. But what will then be the type of complex_computation ? int result -> int -> int ? int -> int result -> int ? int result -> int result -> int ? int result -> int result -> int result ? Diego Olivier ------------------- 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