From: Joel Reymont <joelr1@gmail.com>
To: Gabriel Scherer <gabriel.scherer@gmail.com>
Cc: Goswin von Brederlow <goswin-v-b@web.de>, caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] do i need a private row type?
Date: Mon, 16 May 2011 14:02:16 +0200 [thread overview]
Message-ID: <41CB8ADB-D274-4D07-B5BB-E724F74C44C0@gmail.com> (raw)
In-Reply-To: <BANLkTik79B8+OgTHvieYDzL_DKs4su68wg@mail.gmail.com>
Here's the problem reduced to a single file.
Two files, actually, the first one showing my intended use.
The error is
File "zmq.ml", line 72, characters 7-86:
Error: A type variable is unbound in this type declaration.
In type
([< `Dealer | `Pair | `Pub | `Pull | `Push | `Rep | `Req | `Router | `Sub ]
as 'a)
Socket.t the variable 'a is unbound
Thanks, Joel
P.S.
--- foo.ml
#use "topfind";;
#require "zmq";;
open ZMQ;;
open ZMQ.Socket;;
open ZMQ.Poll;;
let context = init ();;
let pub_endpoint = "tcp://127.0.0.1:9997";;
let pull_endpoint = "tcp://127.0.0.1:9996";;
let pub =
let sock = Socket.create context pub in
connect sock pub_endpoint;
sock;;
let pull =
let sock = Socket.create context pull in
connect sock pull_endpoint;
sock;;
let timeout = 1000000 (* 1s *);;
let poll_set = of_poll_items [| pull, In; pub, Out |] in
match poll ~timeout poll_set with
| [| pull, In |] ->
let msg = recv pull in
()
| _ ->
()
;;
--- zmq.ml
module Socket :
sig
type 'a t
type 'a kind
val pair : [`Pair] kind
val pub : [`Pub] kind
val sub : [`Sub] kind
val req : [`Req] kind
val rep : [`Rep] kind
val dealer : [`Dealer] kind
val router : [`Router] kind
val pull : [`Pull] kind
val push : [`Push] kind
val create : 'a kind -> 'a t
val connect : 'a t -> string -> unit
val bind : 'a t -> string -> unit
val subscribe : [`Sub] t -> string -> unit
val unsubscribe : [`Sub] t -> string -> unit
end = struct
type 'a t = int
type 'a kind = int
let pair = 0
let pub = 1
let sub = 2
let req = 3
let rep = 4
let dealer = 5
let router = 6
let pull = 7
let push = 8
let create kind = 1
let connect sock endpoint = ()
let bind sock endpoint = ()
let subscribe socket new_subscription = ()
let unsubscribe socket old_subscription = ()
end
module Device :
sig
val streamer : [`Pull] Socket.t -> [`Push] Socket.t -> unit
val forwarder : [`Sub] Socket.t -> [`Pub] Socket.t -> unit
val queue : [`Router] Socket.t -> [`Dealer] Socket.t -> unit
end = struct
let streamer sock1 sock2 = ()
let forwarder sock1 sock2 = ()
let queue sock1 sock2 = ()
end
module Poll :
sig
type t
type event_mask = In | Out | In_out
type poll_socket = [<`Pair|`Pub|`Sub|`Req|`Rep|`Dealer|`Router|`Pull|`Push] Socket.t
type poll_item = (poll_socket * event_mask)
val of_poll_items : poll_item array -> t
end = struct
type t = string
let of_poll_items items = "create poll set"
end
--------------------------------------------------------------------------
- for hire: mac osx device driver ninja, kernel extensions and usb drivers
---------------------+------------+---------------------------------------
http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
---------------------+------------+---------------------------------------
next prev parent reply other threads:[~2011-05-16 12:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-15 13:56 Joel Reymont
2011-05-16 6:24 ` Goswin von Brederlow
2011-05-16 7:07 ` Gabriel Scherer
2011-05-16 8:57 ` Joel Reymont
2011-05-16 9:31 ` Joel Reymont
2011-05-16 9:58 ` Joel Reymont
2011-05-16 10:05 ` Joel Reymont
2011-05-16 12:02 ` Joel Reymont [this message]
2011-05-16 12:32 ` Joel Reymont
2011-05-16 13:02 ` Joel Reymont
2011-05-16 13:39 ` Gabriel Scherer
2011-05-16 13:46 ` Joel Reymont
2011-05-16 14:02 ` Joel Reymont
2011-05-16 14:06 ` Gabriel Scherer
2011-05-16 14:08 ` Joel Reymont
2011-05-17 4:26 ` Goswin von Brederlow
2011-05-19 4:15 ` Pedro Borges
2011-05-19 7:33 ` Joel Reymont
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=41CB8ADB-D274-4D07-B5BB-E724F74C44C0@gmail.com \
--to=joelr1@gmail.com \
--cc=caml-list@inria.fr \
--cc=gabriel.scherer@gmail.com \
--cc=goswin-v-b@web.de \
/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