caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] fighting the type system
@ 2011-03-23 22:01 Joel Reymont
  2011-03-23 22:19 ` [Caml-list] " Joel Reymont
  2011-03-23 23:56 ` [Caml-list] " Jacques Garrigue
  0 siblings, 2 replies; 6+ messages in thread
From: Joel Reymont @ 2011-03-23 22:01 UTC (permalink / raw)
  To: caml-list

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
---------------------+------------+---------------------------------------




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-03-24  0:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23 22:01 [Caml-list] fighting the type system Joel Reymont
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

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).