From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8RJPS3f030399 for ; Tue, 27 Sep 2011 21:25:28 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiEBANohgk7RVdY2imdsb2JhbABBp3YIFAEBAQoJDQcSBiKBUwEBAQEDEgITCwEFCAEbDw0BAQMMBgULDQkWDwkDAgECARERAQUBHAYNAQcBAR6HWJ0OCotMglyFHTuIbgIEBocFBJNShSKBKoY+PYNv X-IronPort-AV: E=Sophos;i="4.68,450,1312149600"; d="scan'208";a="110820158" Received: from mail-bw0-f54.google.com ([209.85.214.54]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 27 Sep 2011 21:25:22 +0200 Received: by bkbzs8 with SMTP id zs8so12235719bkb.27 for ; Tue, 27 Sep 2011 12:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=m0a4cjQBZ4PusXUKA1dcAn9buQiYW8nuJXpE44pHAKA=; b=tEVCWsKEv8/f9YDPKkSDPJw2UoiYiufknWEnJpCNzuqmuqVbxFk2wBZt36LN3xM+HZ 6a3qkHO4sIuHwYPjRkv6juLwhs+anM4Lr8CxxT3vt3xb50rFIE2ytFHnnZi2mxdSNPXu dHtBy+6Q7Im8SQxplgRgTNjhPELYr5eJ8a6E4= Received: by 10.204.137.10 with SMTP id u10mr2891671bkt.237.1317151522172; Tue, 27 Sep 2011 12:25:22 -0700 (PDT) Received: from [10.69.8.215] (suze.rez-metz.supelec.fr. [193.48.225.215]) by mx.google.com with ESMTPS id d1sm25667783bku.1.2011.09.27.12.25.21 (version=SSLv3 cipher=OTHER); Tue, 27 Sep 2011 12:25:21 -0700 (PDT) Message-ID: <4E82231D.3030009@gmail.com> Date: Tue, 27 Sep 2011 21:25:17 +0200 From: Thibault Suzanne User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2 MIME-Version: 1.0 To: Walter Cazzola CC: Christophe Papazian , OCaML Mailing List References: <53C8B18E-A3AD-4DB1-A477-EE7FA7846845@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] still silly issues on polymorphic types Le 27/09/2011 20:43, Walter Cazzola a écrit : > On Tue, 27 Sep 2011, Christophe Papazian wrote: > >>> uhm, I have a couple of questions I don't understand on your >>> explanation: >>> - why the most general type is int->'a and not 'a -> 'b? > >> Because if I need a function of type int -> 'a I can give a function >> of type 'a -> 'b. >> But if I need a function of type 'a -> 'b I can not use a function of >> type int -> 'a. >> So int -> 'a is more general and 'a -> 'b is more specific. > >> General rule : if a < b then (a->c) > (b->c) > > probably this is a question whose answer will be RTFM but I'll try to > get your mercy (;-)): what define that a is lesser than b? is there a > table of the precendece among types? > Disclaimer : I'm not at all an expert and i discovered these things with these mails. But if I've understood, "a is lesser than b" means that when a function expects an argument of type 'b, a value of type 'a can be given to this function. For an example, List.length can take a value of type int list, because int list < 'a list. If I remember, in fact, 'a < 'b if a value of type 'a is also a value of type 'b.