From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id AFCEF7ED26 for ; Fri, 25 May 2012 00:17:35 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhoPAEeyvk/RVda2kGdsb2JhbABEpWuOcwgiAQEBAQkJDQcUBCOCFQEBAQQSAhMZATgBAwwBBQULDS4hARIBBQEcBhMbB4ddAwudFAkDjxKFHycNiUgBBQyKEmGFIAONEogGineDHj2BU4I3 X-IronPort-AV: E=Sophos;i="4.75,653,1330902000"; d="scan'208";a="159885637" Received: from mail-ob0-f182.google.com ([209.85.214.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 25 May 2012 00:17:35 +0200 Received: by obcni5 with SMTP id ni5so522992obc.27 for ; Thu, 24 May 2012 15:17:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=FppgwXCAP4jV8/0AdFFKzqp6J16aC2igEQWWsjSLYlM=; b=yK0L5DtLrdnvlu0E5uuwKFFS+NI0fJ0e/FDUXXmjDE9JPHbl0ivuwMkxZvZBFN1oFM Y/S51VhiTTKKKzzY1MFT2zcPGYTKixdOc6COaNG8caxJvQWICgIHlAmAznudnKO4mzHM dX3dnF7WmILfq4SFO1h/8K3lMLjmDSmV2pvKpmrjO8UWxNRj9nvI+scN+Jw8I9f2jdsk ssltClwRRoi0fQlq63z64vchWMfomejCAJgs3u1gp5GQW9+28PUirnoWYIYGayASnDvF Uu85i4d1TUQk6+/hHgQurB1FgkHWF/yG67mj2ghd16fELU+6dkibC951F1j9t878WZvH jHqw== MIME-Version: 1.0 Received: by 10.182.167.39 with SMTP id zl7mr1152441obb.10.1337897853943; Thu, 24 May 2012 15:17:33 -0700 (PDT) Sender: philippe.wang.lists@gmail.com Received: by 10.182.60.193 with HTTP; Thu, 24 May 2012 15:17:33 -0700 (PDT) In-Reply-To: References: Date: Fri, 25 May 2012 00:17:33 +0200 X-Google-Sender-Auth: LE363F5yW7Ngbm2qphsRaVxaI7A Message-ID: From: Philippe Wang To: bob zhang Cc: Caml List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Caml-list] A weird typing error Hi, I re-wrote your program, twice. First time: The actual problem was submerged... so I removed the irrelevant code. It became: type 'a twice =3D 'a class map =3D object ((self : 'self_type)) method twice : 'a0 'b0. ('self_type -> 'a0 -> 'b0) -> 'a0 twice -> 'b0 tw= ice =3D fun mf_a -> mf_a self end =3D> ocamlc points a surprising error at line 1. I don't quite understand... Second time: well, line 1 seems fine to me. I added some missing parameters. It became: type 'a twice =3D 'a class map =3D object ((self : 's)) method twice : 'a0 'b0. ('s -> 'a0 -> 'b0) -> 'a0 twice -> 'b0 twice =3D fun mf_a x -> mf_a (self : 's) (x: 'a0 twice) end =3D> ocamlc points the same error, but at line 5, which is a lot better, much less weird... Well, kind of same error: the weird (buggy) part of the message is removed, the important part is kept. And now... I just don't know why it doesn't type-check. All I have left to say is that I hate encoding data into type names. It's fun when it works. It's hell otherwise. I'm curious to understand the solution of this weird problem, if someone unravels it. Cheers. Philippe Wang On Thu, May 24, 2012 at 7:55 PM, bob zhang wrote: > > Hi, list > =A0 =A0 I came across a weird type error. > =A0 =A0 The error message is =A0"Error: The implementation type_error_ppo= .ml > =A0 =A0 =A0 =A0does not match the interface (inferred signature):" > =A0 =A0 I attached the file > =A0 =A0Many thanks > > -- > -- Bob