1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
type ('a, 's) io
type ('k, 'v, 's) store
type 's scheduler = {
bind : 'a 'b. ('a, 's) io -> ('a -> ('b, 's) io) -> ('b, 's) io;
return : 'a. 'a -> ('a, 's) io;
}
type ('flow, 'error, 's) flow = {
recv :
'flow ->
Cstruct.t ->
(([ `End_of_flow | `Input of int ], 'error) result, 's) io;
send : 'flow -> Cstruct.t -> ((int, 'error) result, 's) io;
pp_error : Format.formatter -> 'error -> unit;
}
type ('uid, 'ref, 'v, 'g, 's) access = {
get : 'uid -> ('uid, 'v, 'g) store -> ('v option, 's) io;
parents : 'uid -> ('uid, 'v, 'g) store -> ('v list, 's) io;
deref : ('uid, 'v, 'g) store -> 'ref -> ('uid option, 's) io;
locals : ('uid, 'v, 'g) store -> ('ref list, 's) io;
shallowed : ('uid, 'v, 'g) store -> ('uid list, 's) io;
shallow : ('uid, 'v, 'g) store -> 'uid -> (unit, 's) io;
unshallow : ('uid, 'v, 'g) store -> 'uid -> (unit, 's) io;
}
module type SCHED = sig
type +'a s
type t
external inj : 'a s -> ('a, t) io = "%identity"
external prj : ('a, t) io -> 'a s = "%identity"
end
module type STORE = sig
type ('a, 'b) s
type t
external inj : ('a, 'b) s -> ('a, 'b, t) store = "%identity"
external prj : ('a, 'b, t) store -> ('a, 'b) s = "%identity"
end
module type IO = sig
type +'a t
val bind : 'a t -> ('a -> 'b t) -> 'b t
val return : 'a -> 'a t
val fail : exn -> 'a t
val async : (unit -> unit t) -> unit
end
module type UID = sig
type t
val of_hex : string -> t
val to_hex : t -> string
val compare : t -> t -> int
end
module type REF = sig
type t
val v : string -> t
val equal : t -> t -> bool
val to_string : t -> string
val segs : t -> string list
end
module type FLOW = sig
type +'a fiber
type t
type error
val recv :
t -> Cstruct.t -> ([ `End_of_flow | `Input of int ], error) result fiber
val send : t -> Cstruct.t -> (int, error) result fiber
val pp_error : error Fmt.t
end