Skip to content

Commit 60d3c91

Browse files
v0.18~preview.130.55+197
1 parent 67f8f67 commit 60d3c91

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3499
-2065
lines changed

src/applicative.ml

Lines changed: 49 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ module List = List0
33
include Applicative_intf.Definitions
44

55
[%%template
6-
module%template.portable Make3 (X : Basic3) :
7-
S3 with type ('a, 'p, 'q) t := ('a, 'p, 'q) X.t = struct
6+
[@@@kind.default k = (value, value_or_null mod maybe_null)]
7+
8+
module%template.portable Make3 (X : Basic3 [@kind k]) :
9+
S3 [@kind k] with type ('a, 'p, 'q) t := ('a, 'p, 'q) X.t = struct
810
include X
911

1012
let ( <*> ) = apply
@@ -33,24 +35,25 @@ module%template.portable Make3 (X : Basic3) :
3335
end
3436
end
3537

36-
module%template.portable [@modality p] Make2 (X : Basic2) :
37-
S2 with type ('a, 'p) t := ('a, 'p) X.t = Make3 [@modality p] (struct
38+
module%template.portable [@modality p] Make2 (X : Basic2 [@kind k]) :
39+
S2 [@kind k] with type ('a, 'p) t := ('a, 'p) X.t =
40+
Make3 [@kind k] [@modality p] (struct
3841
include X
3942

4043
type ('a, 'p, _) t = ('a, 'p) X.t
4144
end)
4245

43-
module%template.portable [@modality p] Make (X : Basic) : S with type 'a t := 'a X.t =
44-
Make3 [@modality p] (struct
46+
module%template.portable [@modality p] Make (X : Basic [@kind k]) :
47+
S [@kind k] with type 'a t := 'a X.t = Make3 [@kind k] [@modality p] (struct
4548
include X
4649

4750
type ('a, _, _) t = 'a X.t
4851
end)
4952

5053
[@@@mode.default m = (global, local)]
5154

52-
module%template.portable Make3_using_map2 (X : Basic3_using_map2 [@mode m]) :
53-
S3 [@mode m] with type ('a, 'p, 'q) t := ('a, 'p, 'q) X.t = struct
55+
module%template.portable Make3_using_map2 (X : Basic3_using_map2 [@kind k] [@mode m]) :
56+
S3 [@kind k] [@mode m] with type ('a, 'p, 'q) t := ('a, 'p, 'q) X.t = struct
5457
include X
5558

5659
let apply tf ta = map2 tf ta ~f:(fun f a -> f a)
@@ -87,23 +90,26 @@ end
8790
module%template.portable
8891
[@modality p] Make2_using_map2
8992
(X : Basic2_using_map2
90-
[@mode m]) : S2 [@mode m] with type ('a, 'p) t := ('a, 'p) X.t =
91-
Make3_using_map2 [@mode m] [@modality p] (struct
93+
[@kind k] [@mode m]) : S2 [@kind k] [@mode m] with type ('a, 'p) t := ('a, 'p) X.t =
94+
Make3_using_map2 [@kind k] [@mode m] [@modality p] (struct
9295
include X
9396

9497
type ('a, 'p, _) t = ('a, 'p) X.t
9598
end)
9699

97-
module%template.portable [@modality p] Make_using_map2 (X : Basic_using_map2 [@mode m]) :
98-
S [@mode m] with type 'a t := 'a X.t = Make3_using_map2 [@mode m] [@modality p] (struct
100+
module%template.portable
101+
[@modality p] Make_using_map2
102+
(X : Basic_using_map2
103+
[@kind k] [@mode m]) : S [@kind k] [@mode m] with type 'a t := 'a X.t =
104+
Make3_using_map2 [@kind k] [@mode m] [@modality p] (struct
99105
include X
100106

101107
type ('a, _, _) t = 'a X.t
102108
end)
103109

104-
module%template.portable [@modality p] Of_monad3 (M : Monad.S3 [@mode m]) :
105-
S3 [@mode m] with type ('a, 'p, 'q) t := ('a, 'p, 'q) M.t =
106-
Make3_using_map2 [@mode m] [@modality p] (struct
110+
module%template.portable [@modality p] Of_monad3 (M : Monad.S3 [@kind k] [@mode m]) :
111+
S3 [@kind k] [@mode m] with type ('a, 'p, 'q) t := ('a, 'p, 'q) M.t =
112+
Make3_using_map2 [@kind k] [@mode m] [@modality p] (struct
107113
type ('a, 'p, 'q) t = ('a, 'p, 'q) M.t
108114

109115
let return = M.return
@@ -115,26 +121,31 @@ Make3_using_map2 [@mode m] [@modality p] (struct
115121
let map = `Custom M.map
116122
end)
117123

118-
module%template.portable [@modality p] Of_monad2 (M : Monad.S2 [@mode m]) :
119-
S2 [@mode m] with type ('a, 'p) t := ('a, 'p) M.t =
120-
Of_monad3 [@mode m] [@modality p] (struct
124+
module%template.portable [@modality p] Of_monad2 (M : Monad.S2 [@kind k] [@mode m]) :
125+
S2 [@kind k] [@mode m] with type ('a, 'p) t := ('a, 'p) M.t =
126+
Of_monad3 [@kind k] [@mode m] [@modality p] (struct
121127
include M
122128

123129
type ('a, 'p, _) t = ('a, 'p) M.t
124130
end)
125131

126-
module%template.portable [@modality p] Of_monad (M : Monad.S [@mode m]) :
127-
S [@mode m] with type 'a t := 'a M.t = Of_monad3 [@mode m] [@modality p] (struct
132+
module%template.portable [@modality p] Of_monad (M : Monad.S [@kind k] [@mode m]) :
133+
S [@kind k] [@mode m] with type 'a t := 'a M.t =
134+
Of_monad3 [@kind k] [@mode m] [@modality p] (struct
128135
include M
129136

130137
type ('a, _, _) t = 'a M.t
131138
end)
132139

133-
module%template.portable [@modality p] Compose (F : S [@mode m]) (G : S [@mode m]) :
134-
S [@mode m] with type 'a t = 'a F.t G.t = struct
140+
module%template.portable
141+
[@modality p] Compose
142+
(F : S
143+
[@kind k] [@mode m])
144+
(G : S
145+
[@kind k] [@mode m]) : S [@kind k] [@mode m] with type 'a t = 'a F.t G.t = struct
135146
type 'a t = 'a F.t G.t
136147

137-
include Make_using_map2 [@mode m] [@modality p] (struct
148+
include Make_using_map2 [@kind k] [@mode m] [@modality p] (struct
138149
type nonrec 'a t = 'a t
139150

140151
let return a = G.return (F.return a)
@@ -144,11 +155,15 @@ module%template.portable [@modality p] Compose (F : S [@mode m]) (G : S [@mode m
144155
end)
145156
end
146157

147-
module%template.portable [@modality p] Pair (F : S [@mode m]) (G : S [@mode m]) :
148-
S [@mode m] with type 'a t = 'a F.t * 'a G.t = struct
158+
module%template.portable
159+
[@modality p] Pair
160+
(F : S
161+
[@kind k] [@mode m])
162+
(G : S
163+
[@kind k] [@mode m]) : S [@kind k] [@mode m] with type 'a t = 'a F.t * 'a G.t = struct
149164
type 'a t = 'a F.t * 'a G.t
150165

151-
include Make_using_map2 [@mode m] [@modality p] (struct
166+
include Make_using_map2 [@kind k] [@mode m] [@modality p] (struct
152167
type nonrec 'a t = 'a t
153168

154169
let return a = F.return a, G.return a
@@ -162,13 +177,13 @@ end
162177

163178
module Make_let_syntax3
164179
(X : sig
165-
include For_let_syntax3 [@mode m]
180+
include For_let_syntax3 [@kind k] [@mode m]
166181
end)
167182
(Intf : sig
168183
module type S
169184
end)
170185
(Impl : Intf.S) : sig
171-
include Let_syntax3 [@mode m]
186+
include Let_syntax3 [@kind k] [@mode m]
172187
end
173188
with type ('a, 'p, 'q) t := ('a, 'p, 'q) X.t
174189
with module Open_on_rhs_intf := Intf = struct
@@ -184,17 +199,17 @@ end
184199

185200
module Make_let_syntax2
186201
(X : sig
187-
include For_let_syntax2 [@mode m]
202+
include For_let_syntax2 [@kind k] [@mode m]
188203
end)
189204
(Intf : sig
190205
module type S
191206
end)
192207
(Impl : Intf.S) : sig
193-
include Let_syntax2 [@mode m]
208+
include Let_syntax2 [@kind k] [@mode m]
194209
end
195210
with type ('a, 'p) t := ('a, 'p) X.t
196211
with module Open_on_rhs_intf := Intf =
197-
Make_let_syntax3 [@mode m] [@modality p]
212+
Make_let_syntax3 [@kind k] [@mode m] [@modality p]
198213
(struct
199214
include X
200215

@@ -205,17 +220,17 @@ module Make_let_syntax2
205220

206221
module Make_let_syntax
207222
(X : sig
208-
include For_let_syntax [@mode m]
223+
include For_let_syntax [@kind k] [@mode m]
209224
end)
210225
(Intf : sig
211226
module type S
212227
end)
213228
(Impl : Intf.S) : sig
214-
include Let_syntax [@mode m]
229+
include Let_syntax [@kind k] [@mode m]
215230
end
216231
with type 'a t := 'a X.t
217232
with module Open_on_rhs_intf := Intf =
218-
Make_let_syntax3 [@mode m] [@modality p]
233+
Make_let_syntax3 [@kind k] [@mode m] [@modality p]
219234
(struct
220235
include X
221236

0 commit comments

Comments
 (0)