caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Joel Reymont <joelr1@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Re: fighting the type system
Date: Wed, 23 Mar 2011 23:52:17 +0000	[thread overview]
Message-ID: <524B4BEB-ACFC-4C05-9695-9B2A7B646FB7@gmail.com> (raw)
In-Reply-To: <67C135E4-6D99-410A-A88A-C3AEF6275698@gmail.com>

A much reduced version. Help!

--- Util.ml

open ZMQ
open ZMQ.Socket
open Thrift

let make_proto = 
  let inbuf = Buffer.create 0
  and outbuf = Buffer.create 0 in
  let tx = new TBufferTransport.t inbuf outbuf in
  new TBinaryProtocol.t tx

type 'a request = < write : Protocol.t -> unit; .. > as 'a

module type Endpoint = 
sig 
  val request : unit -> 'a request
  val read_request : Protocol.t -> 'a request
end

module SimpleService (E: Endpoint) = 
struct 
  let server endpoint =  
    let proto = make_proto in
    E.read_request proto
end

--- A.ml

module U = Util
module T = AdCampaign_types

module Ads = 
struct
  let read_request = T.read_request
  let request () = new T.request
end

module M = U.SimpleService(Ads)

--- Error

File "src/ads.ml", line 10, characters 27-30:
Error: Signature mismatch:
       Modules do not match:
         sig
           val read_request : Thrift.Protocol.t -> T.request
           val request : unit -> T.request
         end
       is not included in
         U.Endpoint
       Values do not match:
         val request : unit -> T.request
       is not included in
         val request :
           unit -> < write : Thrift.Protocol.t -> unit; .. > U.request


  reply	other threads:[~2011-03-23 23:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 22:01 [Caml-list] " Joel Reymont
2011-03-23 22:19 ` [Caml-list] " Joel Reymont
2011-03-23 23:52   ` Joel Reymont [this message]
2011-03-23 23:56 ` [Caml-list] " Jacques Garrigue
2011-03-24  0:16   ` Joel Reymont
2011-03-24  0:48     ` Jacques Garrigue

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=524B4BEB-ACFC-4C05-9695-9B2A7B646FB7@gmail.com \
    --to=joelr1@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).