@@ -152,26 +152,14 @@ let get_mod_bound_doc mod_bound =
152152 in
153153 let * description =
154154 match parsed with
155- | Axis_pair (Modal (Comonadic Areality), Local) -> Some " "
156- | Axis_pair (Modal (Comonadic Areality), Regional) -> None
157- | Axis_pair (Modal (Comonadic Areality), Global) -> Some " "
158- | Axis_pair (Modal (Monadic Contention), Contended) -> Some " "
159- | Axis_pair (Modal (Monadic Contention), Shared) -> Some " "
160- | Axis_pair (Modal (Monadic Contention), Uncontended) -> Some " "
161- | Axis_pair (Modal (Comonadic Portability), Nonportable) -> Some " "
162- | Axis_pair (Modal (Comonadic Portability), Portable) -> Some " "
163- | Axis_pair (Modal (Monadic Uniqueness), Aliased) -> Some " "
164- | Axis_pair (Modal (Monadic Uniqueness), Unique) -> Some " "
165- | Axis_pair (Modal (Comonadic Linearity), Once) -> Some " "
166- | Axis_pair (Modal (Comonadic Linearity), Many) -> Some " "
167- | Axis_pair (Modal (Comonadic Yielding), Yielding) -> Some " "
168- | Axis_pair (Modal (Comonadic Yielding), Unyielding) -> Some " "
169- | Axis_pair (Modal (Monadic Visibility), Immutable) -> Some " "
170- | Axis_pair (Modal (Monadic Visibility), Read) -> Some " "
171- | Axis_pair (Modal (Monadic Visibility), Read_write) -> Some " "
172- | Axis_pair (Modal (Comonadic Statefulness), Stateful) -> Some " "
173- | Axis_pair (Modal (Comonadic Statefulness), Observing) -> Some " "
174- | Axis_pair (Modal (Comonadic Statefulness), Stateless) -> Some " "
155+ | Axis_pair (Modal (Comonadic _ ), _ ) ->
156+ Some
157+ (Format. asprintf
158+ " Values of this type can cross to `%s` from weaker modes." mod_bound)
159+ | Axis_pair (Modal (Monadic _ ), _ ) ->
160+ Some
161+ (Format. asprintf
162+ " Values of this type can cross from `%s` to stronger modes" mod_bound)
175163 | Axis_pair (Nonmodal Externality, Internal) ->
176164 Some " Values of types of this kind might be pointers to the OCaml heap"
177165 | Axis_pair (Nonmodal Externality, External64) ->
@@ -220,20 +208,6 @@ module Modal_axis_pair = struct
220208 | P (Nonmodal _ , _ ) -> None
221209end
222210
223- let get_url_for_mode_axis (type a ) (axis : a Mode.Value.Axis.t ) =
224- let subpage =
225- match axis with
226- | Comonadic Areality -> " stack-allocation/intro/"
227- | Monadic Contention -> " parallelism/01-intro/"
228- | Comonadic Portability -> " parallelism/01-intro/"
229- | Monadic Uniqueness -> " uniqueness/intro/"
230- | Comonadic Linearity -> " uniqueness/intro/"
231- | Comonadic Yielding -> " todo"
232- | Monadic Visibility -> " todo"
233- | Comonadic Statefulness -> " todo"
234- in
235- syntax_doc_url Oxcaml subpage
236-
237211let get_mode_doc mode =
238212 let open Option.Infix in
239213 let * (P (axis, mode)) = Modal_axis_pair. of_string mode in
@@ -246,11 +220,11 @@ let get_mode_doc mode =
246220 | Monadic Contention , Contended ->
247221 Some
248222 " This usage of the value cannot read or write the mutable parts of the \
249- value"
223+ value (unless they are atomic) "
250224 | Monadic Contention , Shared ->
251225 Some
252226 " This usage of the value can read but not write the mutable parts of \
253- the value"
227+ the value (unless they are atomic) "
254228 | Monadic Contention , Uncontended ->
255229 Some
256230 " This usage of the value can read and write the mutable parts of the \
@@ -267,21 +241,44 @@ let get_mode_doc mode =
267241 Some " This usage of the value is the only usage of the value."
268242 | Comonadic Linearity , Once -> Some " This value can be used at most once"
269243 | Comonadic Linearity , Many -> Some " This value can be used many times"
270- | Comonadic Yielding , Yielding -> Some " todo"
271- | Comonadic Yielding , Unyielding -> Some " todo"
272- | Monadic Visibility , Immutable -> Some " todo"
273- | Monadic Visibility , Read -> Some " todo"
274- | Monadic Visibility , Read_write -> Some " todo"
275- | Comonadic Statefulness , Stateful -> Some " todo"
276- | Comonadic Statefulness , Observing -> Some " todo"
277- | Comonadic Statefulness , Stateless -> Some " todo"
244+ | Comonadic Yielding , Yielding -> Some " This value can perform an effect"
245+ | Comonadic Yielding , Unyielding ->
246+ Some " This value cannot perform an effect"
247+ | Monadic Visibility , Immutable ->
248+ Some
249+ " This usage of the value cannot read or write the mutable parts of the \
250+ value"
251+ | Monadic Visibility , Read ->
252+ Some
253+ " This usage of the value can read but not write the mutable parts of \
254+ the value"
255+ | Monadic Visibility , Read_write ->
256+ Some
257+ " This usage of the value can read and write the mutable parts of the \
258+ value"
259+ | Comonadic Statefulness , Stateful ->
260+ Some " This value can read and write mutable data"
261+ | Comonadic Statefulness , Observing ->
262+ Some " This value can read but not write mutable data"
263+ | Comonadic Statefulness , Stateless ->
264+ Some " This value cannot read or write mutable data"
265+ in
266+ let doc_url =
267+ let subpage =
268+ match axis with
269+ | Comonadic Areality -> " stack-allocation/intro/"
270+ | Monadic Contention -> " parallelism/01-intro/"
271+ | Comonadic Portability -> " parallelism/01-intro/"
272+ | Monadic Uniqueness -> " uniqueness/intro/"
273+ | Comonadic Linearity -> " uniqueness/intro/"
274+ | Comonadic Yielding -> " modes/intro/"
275+ | Monadic Visibility -> " modes/intro/"
276+ | Comonadic Statefulness -> " modes/intro/"
277+ in
278+ syntax_doc_url Oxcaml subpage
278279 in
279280 (Some
280- { name = " Mode" ;
281- description;
282- documentation = get_url_for_mode_axis axis;
283- level = Advanced
284- }
281+ { name = " Mode" ; description; documentation = doc_url; level = Advanced }
285282 : syntax_info)
286283
287284let get_modality_doc modality =
@@ -294,19 +291,19 @@ let get_modality_doc modality =
294291 match axis with
295292 | Comonadic _ ->
296293 Format. asprintf
297- " This value is always stronger than %s , even if the container has a \
298- weaker mode."
294+ " This value is always at least as strong as `%s` , even if the \
295+ container has a weaker mode."
299296 modality
300297 | Monadic _ ->
301298 Format. asprintf
302- " This value is always weaker than %s , even if the container has a \
303- stronger mode."
299+ " This value is always at least as weak as `%s` , even if the container \
300+ has a stronger mode."
304301 modality
305302 in
306303 (Some
307304 { name = " Modality" ;
308305 description;
309- documentation = get_url_for_mode_axis axis ;
306+ documentation = syntax_doc_url Oxcaml " modes/syntax/ " ;
310307 level = Advanced
311308 }
312309 : syntax_info)
0 commit comments