caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: bob zhang <bobzhang1988@gmail.com>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] A weird typing error
Date: Thu, 24 May 2012 13:55:49 -0400	[thread overview]
Message-ID: <CANcqPu4imgaGEMBQqYoL+HGzPSz_v4dEtfkzRz=iOxQYKftV0w@mail.gmail.com> (raw)
In-Reply-To: <CANcqPu6B1DAOQ184U5t+wDwwQX=vFguQn0ipTGwvrZ18Hf3r3g@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 228 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 415 bytes --]

[-- Attachment #2: type_error_ppo.ml --]
[-- Type: application/octet-stream, Size: 1324 bytes --]

type 'a m_list = | M_nil | M_cons of 'a * 'a m_list

type 'a twice = 'a

type 'a tree =
  | Leaf | Node of ('a tree) m_list * (('a tree) m_list) twice * 'a

class base =
  object method int : int -> int = fun x -> x
    method float : float -> float = fun x -> x
    method string : string -> string = fun x -> x
  end
  
module EQ =
  struct
    class map =
      object ((self : 'self_type))
        inherit base
        method unknown : 'a. 'a -> 'a = fun x -> x
        method tree :
          'a0 'b0. ('self_type -> 'a0 -> 'b0) -> 'a0 tree -> 'b0 tree =
          fun mf_a ->
            function
            | Leaf -> Leaf
            | Node (a0, a1, a2) ->
                Node ((self#m_list (fun self -> self#tree mf_a) a0),
                  (self#twice
                     (fun self -> self#m_list (fun self -> self#tree mf_a))
                     a1),
                  (mf_a self a2))
        method twice :
          'a0 'b0. ('self_type -> 'a0 -> 'b0) -> 'a0 twice -> 'b0 twice =
          fun mf_a -> mf_a self
        method m_list :
          'a0 'b0. ('self_type -> 'a0 -> 'b0) -> 'a0 m_list -> 'b0 m_list =
          fun mf_a ->
            function
            | M_nil -> M_nil
            | M_cons (a0, a1) ->
                M_cons ((mf_a self a0), (self#m_list mf_a a1))
      end
      
  end
  


       reply	other threads:[~2012-05-24 17:55 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 [this message]
2012-05-24 22:17   ` Philippe Wang
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='CANcqPu4imgaGEMBQqYoL+HGzPSz_v4dEtfkzRz=iOxQYKftV0w@mail.gmail.com' \
    --to=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).