package sessions
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7b9693aa4e8571fc7dadeeb971a24e523ad411a6cfd6d2e087aae05cfd3882cc
md5=c2d5f085a0aa0f6b5cf7cac2568560fb
doc/sessions.lwt/Binary_session_lwt/Make/index.html
Module Binary_session_lwt.Make
Functor to create a module of type Binary_session.Binary_process.
type 'a io = 'a Lwt.tThe abstract monadic type representing a computation returning 'a.
type chan_endpoint = Lwt_io.input_channel * Lwt_io.output_channelThe abstract type representing one end of a communication channel.
The type representing a communication protocol made up of a sequence of operations between two processes. The type 'a is the sequence of operations from the point of view from the first process and 'b its dual is the sequence of operations from the point of view of the second process.
The type representing a process returning a value of type 'a. The type 'b represents the next allowed sequnce of operations and 'c represents the sequence of operations after performing the first operation in 'b.
val send :
'a ->
(unit,
([ `Send of 'a * 'b ], [ `Recv of 'a * 'c ]) session,
('b, 'c) session)
processsend v creates a process which is capable of sending a value of type 'a (v) to the other process.
val recv :
unit ->
('a, ([ `Recv of 'a * 'b ], [ `Send of 'a * 'c ]) session, ('b, 'c) session)
processrecv () creates a process which is capable of receiving a value of type 'a to the other process.
val offer :
('e, ('a, 'b) session, 'f) process ->
('e, ('c, 'd) session, 'f) process ->
('e,
([ `Offer of ('a, 'b) session * ('c, 'd) session ],
[ `Choice of ('b, 'a) session * ('d, 'c) session ])
session,
'f)
processoffer left_choice right_choice creates a process which allows the other process to make a choice between two choices left_choice and right_choice.
val choose_left :
('e, ('a, 'b) session, 'f) process ->
('e,
([ `Choice of ('a, 'b) session * ('c, 'd) session ],
[ `Offer of ('b, 'a) session * ('d, 'c) session ])
session,
'f)
processchoose_left left_choice creates a process which internally chooses left_choice and communicates this choice to the other process.
val choose_right :
('e, ('c, 'd) session, 'f) process ->
('e,
([ `Choice of ('a, 'b) session * ('c, 'd) session ],
[ `Offer of ('b, 'a) session * ('d, 'c) session ])
session,
'f)
processchoose_right right_choice creates a process which internally chooses rigth_choice and communicates this choice to the other process.
stop v creates a process which stops (is not capable of performing any further operations) and returns a value v.
lift_io io lifts the io computation into the process. The processes' capabilities are not altered.
val return : 'a -> ('a, 'b, 'b) processreturn v creates a process which returns v its capabilities are not altered.
p1 >>= f creates a process which is the composition of running p1 then applying.
val run_processes :
('a, ('b, 'c) session, unit) process ->
('d, ('c, 'b) session, unit) process ->
((unit -> 'a io) * (unit -> 'd io)) iorun_process p1 p2 will run two processes p1 and p2 which have dual session types and which have unit as their end state capabilities (i.e., are complete processes). The result is a Binary_session.IO.t returning a pair of functions which may be invoked to run each process.
Note, the channel that is opened between the two processes is closed when the processes have completed.