From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <5764c029b688c1c0d24a2e97cd764f@gmail.com> X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 31B5D7EE49 for ; Fri, 22 Feb 2013 21:13:43 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of 5764c029b688c1c0d24a2e97cd764f@gmail.com) identity=pra; client-ip=74.125.82.50; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-sender="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of 5764c029b688c1c0d24a2e97cd764f@gmail.com designates 74.125.82.50 as permitted sender) identity=mailfrom; client-ip=74.125.82.50; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-sender="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wg0-f50.google.com) identity=helo; client-ip=74.125.82.50; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="5764c029b688c1c0d24a2e97cd764f@gmail.com"; x-sender="postmaster@mail-wg0-f50.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhkHAG7QJ1FKfVIyk2dsb2JhbABEgh0Eg2a7IYENFg4BAQEBCQkLCRQEI4IfAQEFJxEIARscAgMMBgULDQkWDwkDAgECARERAQUBHAYNCAKHewEDDwShKIwygnuEQQoZJw1ZiGUBBQyOTzqDQAOWOoEdhFeJDT+EKg X-IPAS-Result: AhkHAG7QJ1FKfVIyk2dsb2JhbABEgh0Eg2a7IYENFg4BAQEBCQkLCRQEI4IfAQEFJxEIARscAgMMBgULDQkWDwkDAgECARERAQUBHAYNCAKHewEDDwShKIwygnuEQQoZJw1ZiGUBBQyOTzqDQAOWOoEdhFeJDT+EKg X-IronPort-AV: E=Sophos;i="4.84,717,1355094000"; d="scan'208";a="4135511" Received: from mail-wg0-f50.google.com ([74.125.82.50]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 22 Feb 2013 21:13:42 +0100 Received: by mail-wg0-f50.google.com with SMTP id es5so854751wgb.29 for ; Fri, 22 Feb 2013 12:13:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=pgMP8rB8insECDIgxPoIcnLfzbLXOkG+NB99OC4pOmg=; b=umJAl7CUsLQ4POzfWA1pDWvo3SLs/H9LdySp+8hU1H/KiJa/JX2CFLp1LVTnBf2dHw HZVWd81F3xG4SnRHG7DP9dnx8xejVqDloU1eJo6VY6WS0MjxsaD6TWRZhwESVnV1sKVd QKqOE4bibZAqW56rADSGTV4WwKE6SEn9WL5VGRQB/eKzzZgQOkgepHRBmGDrOgPXa8ah TI6yHKCAG8X8x/uxyNA8ila3j0wQog5c9UVNtEnI2nLtj+Q3QB4IcP1lSvpp/OnOSnAx pJsillZPUJB3lRKrneoENRLYRcSv1+8uZuUnmFxLczAYBekHvCyQ90l+e4HLuoJNO5n0 l+Mw== X-Received: by 10.194.91.211 with SMTP id cg19mr5939870wjb.43.1361564022641; Fri, 22 Feb 2013 12:13:42 -0800 (PST) Received: from [172.27.6.173] ([213.106.240.92]) by mx.google.com with ESMTPS id j4sm354534wiz.10.2013.02.22.12.13.41 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Feb 2013 12:13:41 -0800 (PST) Message-ID: <5127D1AB.6090204@gmail.com> Date: Fri, 22 Feb 2013 20:14:35 +0000 From: Matej Kosik <5764c029b688c1c0d24a2e97cd764f@gmail.com> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: OCaml References: <5127AFD7.5040002@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] strange typechecking result On 22/02/13 18:33, Leo White wrote: >> > > I think that by default recursive uses of a function are monomorphic. > You can fix this with an explicit polymorphic annotation: > > let rec f1: 'a. 'a -> unit = fun _ -> () > and f2 r1 = f1 r1.l1 > and f3 r2 = f1 r2.l2;; > > Regards, > > Leo > Yuri, Leo, thanks. Now I see that there is even simpler program, that demonstrates the problem: let rec f1 _ = () and f2 (value:int) = f1 value and f3 (value:char) = f1 value The typechecker rejects it for similar reasons. File "test.ml", line 8, characters 5-10: Error: This expression has type char but an expression was expected of type int. That's quite strange. I would like to ask: - Where is that restriction explained? (I've searched Ocaml reference manual for "monomorphic" but nothing relevant seemed to come up) - Where are things like: 'a. 'a -> unit described? I've already seen it in some document, but now I fail to find it again.