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 MAA09288; Tue, 28 Sep 2004 12:13:14 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA08673 for ; Tue, 28 Sep 2004 12:13:13 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8SADCxs000332 for ; Tue, 28 Sep 2004 12:13:13 +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 i8SADCPt082450 for ; Tue, 28 Sep 2004 12:13:12 +0200 (CEST) X-Ids: 164 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 MAA64134 for ; Tue, 28 Sep 2004 12:10:53 +0200 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda/mob-v8) with ESMTP id MAA1335470 for ; Tue, 28 Sep 2004 12:10:41 +0200 X-Authentication-Warning: ibm1.cicrp.jussieu.fr: fernande owned process doing -bs Date: Tue, 28 Sep 2004 12:10:39 +0200 (DST) From: Diego Olivier Fernandez Pons X-X-Sender: fernande@ibm1 To: caml-list@inria.fr Subject: [Caml-list] Caml monomorphisation (was Observations on OCaml vs. Haskell) In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 41593938.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 41593938.001 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 observations:01 haskell:01 jones':01 annotations:01 mli:01 val:01 compiler:01 compiler:01 fernandez:01 fernandez:01 ints:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bonjour, > [Richard Jones] shows that: > > ;;; > let max a b = > if a > b then a else b > in > print_int (max 2 3) > ;;; > > > uses the polymorphic version of '>', even though the use of max here uses > only ints. Why doesn't Caml compiler specialize the type of [max] ? Richard Jones' tutorial says one can help the compiler by specifying types for one or more arguments (type annotations). Does this work if the type annotation is in the .mli file or only in the .ml file inside the function definition ? let max : int -> int -> int = fun x y -> if x < y then y else x wrt let max = fun x y -> if x < y then y else x val max : int -> int -> int 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