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
module type FUNCTOR = sig
type +'a t
end
type (+'a, 't) io
type ('l, 'r) either = L of 'l | R of 'r
type 't impl = {
bind : 'a 'b. ('a, 't) io -> ('a -> ('b, 't) io) -> ('b, 't) io;
return : 'a. 'a -> ('a, 't) io;
}
type ('flow, 's) rdwr = {
rd : 'flow -> bytes -> int -> int -> ([ `End | `Len of int ], 's) io;
wr : 'flow -> string -> int -> int -> (unit, 's) 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