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=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id E2BCFBC6B for ; Sun, 24 Jun 2007 00:25:10 +0200 (CEST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5NMP9jn021519 for ; Sun, 24 Jun 2007 00:25:10 +0200 Received: by py-out-1112.google.com with SMTP id d32so920775pye for ; Sat, 23 Jun 2007 15:25:09 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DssFWd12bcFjm6pUDLPyM2PduIhCXOYyCPBfK/b+EzVm47kRiqikVflwejSM37KutH0z3aOLUjFipCroH0ZyOG5bgGJBeatzx1x0AmqX+gVIZqun6KFYGcBWzDEAE67nkLygLHA5j8lmTGKrPHCxgVey7cZwniHs+7s6k302XPg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=aNNh3adz7IZpICpY56wOI+nwQqNisE+nkjcm4Z/laIi5ARQ046fN6X+FmHJ2amiXw0Fep9/b64xjN9V4/DQFF3Ya70f+EOY7swLDO/e7aZ6Efba3p2G0F3CE7hDto0XOkeXAkw0jtiMl01ArILx2AZuDTXcMUdbt8tvmM23pdeE= Received: by 10.64.183.6 with SMTP id g6mr7397300qbf.1182637509269; Sat, 23 Jun 2007 15:25:09 -0700 (PDT) Received: by 10.64.242.10 with HTTP; Sat, 23 Jun 2007 15:25:09 -0700 (PDT) Message-ID: <4a708d20706231525i7a33eee5iebf62b5ff39d8c2e@mail.gmail.com> Date: Sun, 24 Jun 2007 00:25:09 +0200 From: "Lukasz Stafiniak" To: caml-list Subject: Re: [Caml-list] How do I get polymorphic partial application? In-Reply-To: <9d3ec8300706231509p373e494ci1b05987fb3723e69@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <9d3ec8300706231155p2429504ay6395ea0580756dc7@mail.gmail.com> <467D936C.5020501@philippewang.info> <4a708d20706231449g38836405xc48f4eb6fa82d779@mail.gmail.com> <9d3ec8300706231509p373e494ci1b05987fb3723e69@mail.gmail.com> X-j-chkmail-Score: MSGID : 467D9DC5.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 467D9DC5.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; lukasz:01 cheers:01 polymorphic:01 wrote:01 partial:01 partial:01 caml-list:01 int:01 variables:02 functional:02 top-level:02 string:02 types:03 types:03 let:03 On 6/24/07, Till Varoquaux wrote: > As said previously, in a HM type ineference system type variables are > generalized only in "let", that is: > > let id x = x (*starting with an identity function*) > let id'= id id (*this is a partial application; it has type '_a ->'_a*) > let _= > print_string (id' "a"); > print_int (id' 4) > > won't work (since id' has type '_a->'_a). > > Replacing the definition of id' with the eta expanded version (let id' > x = (id id) x) will however work. It is not 100% equivalent since > every application of the new id' goes twice through id whilst the old > was a reference to id.... > > I hope this answers your question. > Cheers, > Till No, it is related to the so called "value restriction" made Caml-ish way, in a pure functional (no references) HM types can be generalized. And I restate my question: can someone give an example, where if the top-level let-definition types were generalized, this would lead to a crash?