From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q2N4wO4n008909 for ; Fri, 23 Mar 2012 05:58:24 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArkCAFYCbE9CbwQZk2dsb2JhbABEt08iAQEBAQkJCwkUBCOCNxECBjp0KYg9pRySbQaNYYI/Y4hajQgBky8 X-IronPort-AV: E=Sophos;i="4.73,633,1325458800"; d="scan'208";a="150825182" Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 23 Mar 2012 05:58:22 +0100 Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id C592020DCF for ; Fri, 23 Mar 2012 00:58:20 -0400 (EDT) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute4.internal (MEProxy); Fri, 23 Mar 2012 00:58:20 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:subject:message-id :mime-version:content-type; s=smtpout; bh=XbfKhZowvOMLlr0+TKJbzA aoe8g=; b=VU19YLI2nsu4teSa0vmRDl+xPE5ZKhCO1J0XGqWpyv+lvQXI2eU9Oz F77H8MkMrylbUupAdEPyFonlQo7TJnrzcB+jq8scyUq86TI2W5gywWMwH7o/PPAD LEdjTsO6IpTFbNbxfNCGfGtO/S6jbJqANx0nYqc0gokdi0MAq/TeI= X-Sasl-enc: GV3kT3+OCvuiodWfJn563LGftTvZmwM7U5BankgN2tfM 1332478700 Received: from davidb.org (dweb.davidb.org [173.255.246.16]) by mail.messagingengine.com (Postfix) with ESMTPSA id 6E3074825F9 for ; Fri, 23 Mar 2012 00:58:20 -0400 (EDT) Date: Thu, 22 Mar 2012 21:58:18 -0700 From: David Brown To: caml-list@inria.fr Message-ID: <20120323045817.GA26450@davidb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Subject: [Caml-list] Insufficient polymorphism in local let. I'm trying to figure out how to get 'lmust' in 'get2' in the code below to work. It seems that it's type is being inferred as string -> string option -> string instead of string -> 'a option -> 'a The 'must' definition keeps it's polymorphism, as seen in 'get1'. Is there some way I can annotate the definition of 'lmust' so that it will work? Lifting 'lmust' out of 'get2' doesn't seem to help. Thanks, David let must section name = function | Some o -> o | None -> Printf.eprintf "Expecting %s in %s\n%!" name section; exit 1 type foo = { a: string; b: int } let get1 a b = { a = must "get1" "a" a; b = must "get1" "b" b } let get2 a b = (* This isn't polymorphic enough. *) let lmust = must "get2" in { a = lmust "a" a; b = lmust "b" b }