From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p4GC2QCN005074 for ; Mon, 16 May 2011 14:02:26 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuQBAOIR0U1KfVK2kGdsb2JhbACmCwgUAQEBAQkJDQcUBCGqE4wagjWEPTeIYgEBAwaGEwSQEYQvgRGFRTuDNw X-IronPort-AV: E=Sophos;i="4.64,373,1301868000"; d="scan'208";a="108679337" Received: from mail-wy0-f182.google.com ([74.125.82.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 16 May 2011 14:02:20 +0200 Received: by wyf23 with SMTP id 23so6082735wyf.27 for ; Mon, 16 May 2011 05:02:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer; bh=syqnLzedrTVlpgrwybQAbXPnExWNx89rb7DFVDvntLc=; b=yEI9ShJOsrLnqQ8YBLObgMuFH1IfqVD4yQWGAoC3II2B1asjkiwJkSksPDn1DT50m5 qFp2qHSIIER0j/ictjDEjCQQ2U83FEMucMhhRAT5ImANWW8/CqzVxLCSxoJ+xwuRfHnr sHKnXVLJ6ro5p/QwtQLy0susMrgOv9T1T4ZfE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer; b=n5A4LCOi2y2XI2SOxq51+uNKTnM+eTfQNrp5P2GJdq/L5pT+VqbJi1huec0JijM2/e H9U3S30JFy5eWGjusNaB7MtlDZrHb8+t9CbXIUgnhoaSwf73zP7lU381k+xIYXdWML0B uQyWLSC8fpoFKSkU0T3gEu7dUqsXFOf5FrUk0= Received: by 10.216.39.82 with SMTP id c60mr2339859web.30.1305547340440; Mon, 16 May 2011 05:02:20 -0700 (PDT) Received: from [10.0.1.31] ([87.54.60.37]) by mx.google.com with ESMTPS id ed10sm3100138wbb.15.2011.05.16.05.02.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 May 2011 05:02:19 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Joel Reymont In-Reply-To: Date: Mon, 16 May 2011 14:02:16 +0200 Cc: Goswin von Brederlow , caml-list Message-Id: <41CB8ADB-D274-4D07-B5BB-E724F74C44C0@gmail.com> References: <87wrhr9n88.fsf@frosties.localnet> To: Gabriel Scherer X-Mailer: Apple Mail (2.1084) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p4GC2QCN005074 Subject: Re: [Caml-list] do i need a private row type? 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 ---------------------+------------+---------------------------------------