module Bare:sig
..end
val create : ?name:string -> unit -> ('a, 'b) Session.st * ('b, 'a) Session.st
create ()
creates a new session.
val close : Session.et -> unit
close ep
closes endpoint ep
.
InvalidEndpoint
if the
endpoint ep
is invalid.val send : 'm -> ('m * ('a, 'b) Session.st) Session.ot -> ('b, 'a) Session.st
send e ep
sends e
on the endpoint ep
with output
capability.
InvalidEndpoint
if
ep
is invalid.ep
.val receive : ('m * ('a, 'b) Session.st) Session.it -> 'm * ('a, 'b) Session.st
receive ep
receives a message from the endpoint ep
with
input capability.
InvalidEndpoint
if the endpoint
ep
is invalid.(v, ep)
with the received message
v
and the endpoint ep
.val select : (('a, 'b) Session.st -> 'm) -> 'm Session.ot -> ('b, 'a) Session.st
select f ep
sends f
to the peer endpoint of ep
, where it
is used to compute the received message.
InvalidEndpoint
if the endpoint ep
is invalid.ep
.val select_true : [> `True of ('a, 'b) Session.st ] Session.ot -> ('b, 'a) Session.st
select_true ep
selects the True
branch of a choice.
InvalidEndpoint
if the
endpoint ep
is invalid.ep
after the selection.val select_false : [> `False of ('a, 'b) Session.st ] Session.ot -> ('b, 'a) Session.st
select_false ep
selects the False
branch of a choice.
InvalidEndpoint
if the endpoint ep
is invalid.ep
after the selection.val branch : ([> ] as 'm) Session.it -> 'm
branch ep
receives a selection from the endpoint ep
with
input capability.
InvalidEndpoint
if the endpoint ep
is
invalid.ep
injected through the
selected tag.val is_valid : ('a, 'b) Session.st -> bool
is_valid ep
determines whether ep
is a valid endpoint or not.
true
if ep
is valid, false
otherwise.val acquire : ('a, 'b) Session.st -> ('a, 'b) Session.st
acquire ep
acquires the endpoint ep
, if it is valid.
InvalidEndpoint
if ep
invalid.ep
.val try_acquire : ('a, 'b) Session.st -> ('a, 'b) Session.st option
try_acquire ep
attempts to acquire the endpoint ep
.
Some ep
where ep
is the unique valid reference to the endpoint,
if ep
is valid, and None
otherwise.val same_session : ('a, 'b) Session.st -> ('c, 'd) Session.st -> bool
same_session ep ep'
checks whether ep
and ep'
are endpoints
of the same session (but not necessarily peer endpoints).
true
if ep
and ep'
are (possibly peer) endpoints pertaining the
same session, false
otherwise.val string_of_endpoint : ('a, 'b) Session.st -> string
string_of_endpoint ep
returns a textual representation of the
endpoint ep
.
val (@=) : (('a, 'b) Session.st -> 'm * Session.et) ->
((('a, 'b) Session.st, ('c, 'd) Session.st) Session.seq,
(('b, 'a) Session.st, ('d, 'c) Session.st) Session.seq)
Session.st -> 'm * ('c, 'd) Session.st
f @= ep
evaluates f ep
.
InvalidEndpoint
if the second component of f ep
is an endpoint other than ep
.f ep
evaluates.val (@>) : (('a, 'b) Session.st -> Session.et) ->
((('a, 'b) Session.st, ('c, 'd) Session.st) Session.seq,
(('b, 'a) Session.st, ('d, 'c) Session.st) Session.seq)
Session.st -> ('c, 'd) Session.st
f @> ep
evaluates f ep
.
InvalidEndpoint
if f ep
evaluates to an endpoint different from
ep
.ep
.