From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 93F66BB9A for ; Tue, 15 Nov 2005 13:57:50 +0100 (CET) Received: from mail.barettadeit.com (h213-255-109-130.albacom.net [213.255.109.130] (may be forged)) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jAFCvnIa030666 for ; Tue, 15 Nov 2005 13:57:50 +0100 Received: from [10.1.0.20] (unknown [10.1.0.20]) by mail.barettadeit.com (Postfix) with ESMTP id 825041258B; Tue, 15 Nov 2005 14:03:09 +0100 (CET) Message-ID: <4379DB4A.1080907@barettadeit.com> Date: Tue, 15 Nov 2005 13:57:46 +0100 From: Alessandro Baretta User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Vsevolod Fedorov Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] function specialization References: <00a701c5e9da$1b0ebc20$670aa8c0@seva> In-Reply-To: <00a701c5e9da$1b0ebc20$670aa8c0@seva> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-j-chkmail-Score: MSGID : 4379DB4D.000 on nez-perce : j-chkmail score : X : 0/20 1 X-Miltered: at nez-perce with ID 4379DB4D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; baretta:01 baretta:01 barettadeit:01 caml-list:01 wrote:01 expression:01 int:01 int:01 string:02 string:02 unit:03 unit:03 alessandro:03 alex:03 arg:03 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 Vsevolod Fedorov wrote: > Hello! > > I have code like following: > ---- > > type 'a wrap = ('a -> unit) -> 'a -> unit type wrap = { action : 'a. ('a -> unit) -> 'a -> unit } > let wrap fn arg = > fn arg let wrap = { action = fun fn arg -> fn arg } > let fn1 (v: int) = () > let fn2 (v: string) = () > > let use (wrap: 'a wrap) = > wrap fn1 1; > wrap fn2 "" > (* ^^^ This expression has type string -> unit but is here used with > type int -> unit *) let use (wrap : wrap) = wrap.action fn1 1; wrap.action fn2 "" Alex