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
module type FUNCTOR = sig
type +'a t
end
type (+'a, 't) io
type 't state = {
bind : 'a 'b. ('a, 't) io -> ('a -> ('b, 't) io) -> ('b, 't) io
; return : 'a. 'a -> ('a, 't) io
}
module type X = sig
type +'a s
type t
external inj : 'a s -> ('a, t) io = "%identity"
external prj : ('a, t) io -> 'a s = "%identity"
end
module Common = struct
type t
external inj : 'a -> 'b = "%identity"
external prj : 'a -> 'b = "%identity"
end
module Make (T : FUNCTOR) = struct
type +'a s = 'a T.t
include Common
end
module type FLOW = sig
type flow
type +'a io
val input : flow -> bytes -> int -> int -> int io
end
module type DNS = sig
type t
type +'a io
type error =
[ `Msg of string
| `No_data of [ `raw ] Domain_name.t * Dns.Soa.t
| `No_domain of [ `raw ] Domain_name.t * Dns.Soa.t ]
val getrrecord :
t -> 'v Dns.Rr_map.rr -> 'a Domain_name.t -> ('v, [> error ]) result io
end
module type IO = sig
type +'a t
val return : 'a -> 'a t
val bind : 'a t -> ('a -> 'b t) -> 'b t
val both : 'a t -> 'b t -> ('a * 'b) t
val join : unit t list -> unit t
val pause : unit -> unit t
val iter_p : ('a -> unit t) -> 'a list -> unit t
val map_p : ('a -> 'b t) -> 'a list -> 'b list t
val all : 'a t list -> 'a list t
end