module Monadic:sig..end
type ('t0, 't1, 'a) t
The type of a computation that returns a result of type 'a
while using a session endpoint and changing its type from 't0 to
't1.
val return : 'm -> ('t0, 't0, 'm) treturn e is the trivial monadic computation that does not
perform communications and returns the value of e.
val (>>=) : ('t0, 't1, 'a) t ->
('a -> ('t1, 't2, 'b) t) -> ('t0, 't2, 'b) tThe monadic composition operator.
val (>>>) : ('t0, 't1, 'a) t ->
('t1, 't2, 'b) t -> ('t0, 't2, 'b) tm1 >>> m2 is a shortcut for m1 >>= fun _ -> m2.
val fix : (('t0, 't1, 'a) t -> ('t0, 't1, 'a) t) ->
('t0, 't1, 'a) tFixpoint operator for monadic computations. fix (fun x -> m)
represents the same computation as m in which x is bound to m
itself.
val connect : (('a, 'b) Session.st, Session.et, unit) t ->
(('b, 'a) Session.st, Session.et, 'm) t -> 'mconnect ms mc creates a new session that connects the server
ms, spawned into a new thread, and the client mc. The result is
that returned by the client.
val receive : (('m * ('a, 'b) Session.st) Session.it, ('a, 'b) Session.st, 'm)
treceive waits for a message from the session endpoint and
returns its value.
val send : 'm ->
(('m * ('b, 'a) Session.st) Session.ot, ('a, 'b) Session.st, unit)
tsend e sends the message e on the session endpoint.
val branch : ('t0, 't2, 'a) t ->
('t1, 't2, 'a) t ->
(('t0, 't1) Session.choice Session.it, 't2, 'a) tbranch mtrue mfalse accepts a boolean selection from the
session endpoint and executes either mtrue or mfalse
accordingly.
val select_true : ((('b, 'a) Session.st, ('d, 'c) Session.st) Session.choice Session.ot,
('a, 'b) Session.st, unit)
tselect_true selects the True branch of a choice.
val select_false : ((('b, 'a) Session.st, ('d, 'c) Session.st) Session.choice Session.ot,
('c, 'd) Session.st, unit)
tselect_false selects the False branch of a choice.