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=2.8 required=5.0 tests=AWL,RCVD_NUMERIC_HELO, SPF_SOFTFAIL,UNPARSEABLE_RELAY autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id AFD03BB84 for ; Wed, 14 Jan 2009 16:31:18 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.37,263,1231110000"; d="scan'208";a="22468459" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 14 Jan 2009 16:31:18 +0100 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id n0EFVIxP028311 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 14 Jan 2009 16:31:18 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArwBAMiTbUmEpqxqmWdsb2JhbACJD4prHAEBAQEBCAsKBxFPuRSFb4IK X-IronPort-AV: E=Sophos;i="4.37,263,1231110000"; d="scan'208";a="19596628" Received: from cirse-out.extra.cea.fr ([132.166.172.106]) by mail2-smtp-roc.national.inria.fr with ESMTP; 14 Jan 2009 16:31:18 +0100 Received: from nephilia.intra.cea.fr (nephilia.intra.cea.fr [132.166.88.33]) by cirse.extra.cea.fr (8.14.2/8.14.2/CEAnet-Internet-out-1.2) with ESMTP id n0EFVI0J020129 for ; Wed, 14 Jan 2009 16:31:18 +0100 Received: from muguet2.intra.cea.fr (muguet2.intra.cea.fr [132.166.192.7]) by nephilia.intra.cea.fr (8.13.8/8.13.8) with ESMTP id n0EFVHbJ030702 for ; Wed, 14 Jan 2009 16:31:17 +0100 (envelope-from julien.signoles@cea.fr) Received: from mansart.intra.cea.fr (mansart.intra.cea.fr [132.166.88.54]) by muguet2.intra.cea.fr (8.13.8/8.13.8/CEAnet-Intranet-out-1.1) with ESMTP id n0EFVH5V004659 for ; Wed, 14 Jan 2009 16:31:17 +0100 Received: from LAXA.intra.cea.fr ([132.166.64.44]) by mansart.intra.cea.fr with Microsoft SMTPSVC(6.0.3790.3959); Wed, 14 Jan 2009 16:31:17 +0100 Received: from 132.166.135.80 ([132.166.135.80]) by LAXA.intra.cea.fr ([132.166.64.53]) with Microsoft Exchange Server HTTP-DAV ; Wed, 14 Jan 2009 15:31:17 +0000 Received: from is005140 by LAXA.intra.cea.fr; 14 Jan 2009 16:31:24 +0100 Subject: Caml implementation of the relaxed value restriction From: Julien SIGNOLES To: caml-list@inria.fr Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: CEA LIST Date: Wed, 14 Jan 2009 16:31:24 +0100 Message-Id: <1231947084.7199.34.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-OriginalArrivalTime: 14 Jan 2009 15:31:17.0529 (UTC) FILETIME=[24A04890:01C9765D] X-Miltered: at discorde with ID 496E0546.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; signoles:01 signoles:01 ocaml:01 sig:01 val:01 val:01 struct:01 ocaml:01 cvs:01 sigplan:01 lncs:01 91191:01 typing:01 cea:01 cea:01 Hello, In the article "Many Holes in Hindley-Milner" [1], Sam Lindley claims that the type of x is ('a * 'a s, int) NList.t in the following ocaml program because of Garrigue's relaxed value restriction [2]. ========== type 'a s module NList : sig type (+'length, +'elem_type) t val nil : ('m*'m, 'a) t val cons: 'a * ('m*'n, 'a) t -> ('m*'n s,'a) t end = struct type ('i,'a) t = 'a list let nil = [] let cons (x, l) = x :: l end let x = NList.cons (1, NList.nil) ========== But, both with ocaml v3.10.2 and ocaml v3.12.0+dev1 (2008-12-03) (that is the current cvs version), the infered type of [x] only contains a weak type variable: ('_a * '_a s, int) NList.t. I quickly look at the typing rules introduced by Jacques Garrigue in [2] and it seems to me that Sam Lindley is right: [x] is generalisable in the above program. So, what's wrong here? [1] Many Holes in Hindley-Milner. Sam Lindley. In ACM Sigplan Workshop of ML 2008, Victoria, British Columbia, Canada, September 2008. [2] Relaxing the value restriction. Jacques Garrigue. In International Symposium on Functional and Logic Programming, Nara, April 2004. Springer-Verlag LNCS 2998. Best regards, Julien Signoles -- Researcher-engineer CEA LIST, Software Reliability Lab 91191 Gif-Sur-Yvette Cedex tel:(+33)1.69.08.71.83 fax:(+33)1.69.08.83.95 Julien.Signoles@cea.fr