caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Wang <mail@philippewang.info>
To: bob zhang <bobzhang1988@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] A weird typing error
Date: Fri, 25 May 2012 00:17:33 +0200	[thread overview]
Message-ID: <CAAFfW_qSJp2M4jmr-OsE=henkiD8anjFdwRYTBXQHV0X6BiP5Q@mail.gmail.com> (raw)
In-Reply-To: <CANcqPu4imgaGEMBQqYoL+HGzPSz_v4dEtfkzRz=iOxQYKftV0w@mail.gmail.com>

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 = 'a
class map = object ((self : 'self_type))
  method twice : 'a0 'b0. ('self_type -> 'a0 -> 'b0) -> 'a0 twice -> 'b0 twice =
    fun mf_a -> mf_a self
end

=> 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 = 'a
class map =
object ((self : 's))
  method twice : 'a0 'b0. ('s -> 'a0 -> 'b0) -> 'a0 twice -> 'b0 twice =
    fun mf_a x -> mf_a (self : 's)  (x: 'a0 twice)
end

=> 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 <bobzhang1988@gmail.com> wrote:
>
> Hi, list
>     I came across a weird type error.
>     The error message is  "Error: The implementation type_error_ppo.ml
>        does not match the interface (inferred signature):"
>     I attached the file
>    Many thanks
>
> --
> -- Bob

  reply	other threads:[~2012-05-24 22:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CANcqPu6B1DAOQ184U5t+wDwwQX=vFguQn0ipTGwvrZ18Hf3r3g@mail.gmail.com>
2012-05-24 17:55 ` bob zhang
2012-05-24 22:17   ` Philippe Wang [this message]
2012-05-25  5:47     ` Jonathan Protzenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAFfW_qSJp2M4jmr-OsE=henkiD8anjFdwRYTBXQHV0X6BiP5Q@mail.gmail.com' \
    --to=mail@philippewang.info \
    --cc=bobzhang1988@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).