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] fighting the type system
Date: Wed, 23 Mar 2011 22:01:32 +0000	[thread overview]
Message-ID: <07EE3576-E5F0-4187-AE8C-DEFEA5C92303@gmail.com> (raw)

How do I do this?

	Thanks in advance, Joel

---

How do I do this?

module T = Foo

module Ads = 
struct
  let read_request = T.read_request
  let read_response = T.read_response
  let request () = 
    let req = new T.request in
    ...
    req
...

--- Foo.mli

open Thrift
class request :
object ('a)
  method copy : 'a
  method write : Protocol.t -> unit
end
val read_request : Protocol.t -> request
class response :
object ('a)
  method copy : 'a
  method write : Protocol.t -> unit
end
val read_response : Protocol.t -> response

--- Util.ml

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

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


--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------




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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 22:01 Joel Reymont [this message]
2011-03-23 22:19 ` [Caml-list] " Joel Reymont
2011-03-23 23:52   ` Joel Reymont
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=07EE3576-E5F0-4187-AE8C-DEFEA5C92303@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).