Source file OBMonad.ml
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
module type Kernel1 = sig
type 'a t
val return: 'a -> 'a t
val bind: 'a t -> ('a -> 'b t) -> 'b t
end
module type Kernel2 = sig
type ('a, 'b) t
val return: 'a -> ('a, _) t
val bind: ('a, 'b) t -> ('a -> ('c, 'b) t) -> ('c, 'b) t
end
module type S1 = sig
type 'a t
module Core: sig
include Kernel1 with type 'a t := 'a t
end
include module type of Core
module Infix: sig
val (>>=): 'a t -> ('a -> 'b t) -> 'b t
end
end
module type S2 = sig
type ('a, 'b) t
module Core: sig
include Kernel2 with type ('a, 'b) t := ('a, 'b) t
val return: 'a -> ('a, _) t
end
include module type of Core
module Infix: sig
val (>>=): ('a, 'b) t -> ('a -> ('c, 'b) t) -> ('c, 'b) t
end
end
module Make1(K: Kernel1) = struct
type 'a t = 'a K.t
module Core = struct
let return = K.return
let bind = K.bind
end
include Core
module Infix = struct
let (>>=) = bind
end
end
module Make2(K: Kernel2) = struct
type ('a, 'b) t = ('a, 'b) K.t
module Core = struct
let return = K.return
let bind = K.bind
end
include Core
module Infix = struct
let (>>=) = bind
end
end