From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 4D15BBC69 for ; Fri, 24 Aug 2007 21:43:33 +0200 (CEST) Received: from mta-m2.tc.umn.edu (mta-m2.tc.umn.edu [134.84.119.106]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l7OJhW6C024054 for ; Fri, 24 Aug 2007 21:43:32 +0200 Received: from [128.101.106.92] (glu02.cs.umn.edu [128.101.106.92]) by mta-m2.tc.umn.edu (UMN smtpd) with ESMTP for ; Fri, 24 Aug 2007 14:43:27 -0500 (CDT) X-Umn-Remote-Mta: [N] glu02.cs.umn.edu [128.101.106.92] #+LO+TS+AU+HN Message-ID: <46CF34DE.301@cs.umn.edu> Date: Fri, 24 Aug 2007 14:43:26 -0500 From: Christopher Kauffman User-Agent: Thunderbird 1.5.0.12 (X11/20070604) MIME-Version: 1.0 To: OCaml Subject: Question on polymorphic typing for curried functions Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 46CF34E4.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; curried:01 curried:01 polymorphism:01 val:01 val:01 bool:01 bool:01 polymorphism:01 cheers:01 1.0:98 2.0:98 polymorphic:01 polymorphic:01 typing:01 functions:01 I am looking for a bit of information on the behavior of curried functions wrt polymorphic arguments. For instance, in the following example, using a curried function seems to lose the nice polymorphism that I desire. # let genf f a b = f a b;; val genf : ('a -> 'b -> 'c) -> 'a -> 'b -> 'c = # let specf = genf (<);; val specf : '_a -> '_a -> bool = # specf 1 2;; - : bool = true # specf;; - : int -> int -> bool = An alternative definition for the specific 'specf' maintains polymorphism of its arguments. # let specf a b = genf (<) a b;; val specf : 'a -> 'a -> bool = # specf 1 2;; - : bool = true # specf 1.0 2.0;; - : bool = true # specf;; - : 'a -> 'a -> bool = Is there a set of rules or guidelines that determine when argument types are specialized versus staying polymorphic? Cheers, Chris