Commits

Dmitry Grebeniuk  committed 8f9ee78

new funcs to .mli

  • Participants
  • Parent commits ecc3e58

Comments (0)

Files changed (1)

   process_factory 'i ->
   process_factory 'i
 ;
+
+
+(* [pipe 'i 'o] is constructor that takes [addrt 'o] to write
+   "output" messages to this typed address, and returns
+   IO-wrapped [process 'i] that receives process messages
+   of type ['i], does anything that processes usually do,
+   and writes to specified [addrt 'o].
+ *)
+
+type pipe 'i 'o = addrt 'o -> IO.m (process 'i)
+;
+
+
+(* stream transform: many to many *)
+
+value stream_transform :
+  factory ('i * 's) ((list 'o) * 's) ->
+  's ->
+  pipe 'i 'o
+;
+
+
+(* combine_pairs: combines messages tagged by `Fst and `Snd variants
+   pairwise, in the order of their arrival.
+   [`Exit_filling_snd x] is like sending [`Snd x] until all [`Fst _]
+   will be processed, then exitting the process.
+ *)
+
+value combine_pairs :
+  ('a -> 'b -> IO.m unit) ->
+  process_factory
+    [= `Fst of 'a
+    |  `Snd of 'b
+    |  `Exit_filling_snd of 'b
+    ]
+;
+
+
+(* [server_of_pipe_seq] creates a server from pipe, assuming
+   that sequential messages sent by pipe are replies to sequential
+   requests sent to pipe.
+ *)
+
+value server_of_pipe_seq : pipe 'i 'o -> IO.m (server 'i 'o)
+;