@@ -304,6 +304,16 @@ module Make (Syntax : SYNTAX) = struct
304304 { Source_page. url; contents }
305305 end
306306
307+ module Modalities : sig
308+ val format : Odoc_model.Lang.Modalities .t -> text
309+ end = struct
310+ let format = function
311+ | [] -> O. noop
312+ | mods ->
313+ O. txt " " ++ O. txt " @@" ++ O. txt " "
314+ ++ O. txt (String. concat ~sep: " " mods)
315+ end
316+
307317 module Type_expression : sig
308318 val type_expr : ?needs_parentheses : bool -> Lang.TypeExpr .t -> text
309319
@@ -454,10 +464,7 @@ module Make (Syntax : SYNTAX) = struct
454464 let res =
455465 kind_annotation ~needs_parentheses: true base
456466 ++ O. txt " " ++ O. keyword " with" ++ O. txt " " ++ type_expr ty
457- ++
458- match modalities with
459- | [] -> O. noop
460- | mods -> O. txt " @@ " ++ O. txt (String. concat ~sep: " " mods)
467+ ++ Modalities. format modalities
461468 in
462469 enclose_parens_if_needed res
463470 | Kind_of ty ->
@@ -607,21 +614,18 @@ module Make (Syntax : SYNTAX) = struct
607614 val format_constraints : (Lang.TypeExpr .t * Lang.TypeExpr .t ) list -> text
608615 end = struct
609616 let record fields =
610- let field mutable_ id typ =
617+ let field mutable_ id typ modalities =
611618 let url = Url. from_identifier ~stop_before: true id in
612619 let name = Paths.Identifier. name id in
613620 let attrs = [ " def" ; " record" ; Url.Anchor. string_of_kind url.kind ] in
614621 let cell =
615- (* O.td ~a:[ O.a_class ["def"; kind ] ]
616- * [O.a ~a:[O.a_href ("#" ^ anchor); O.a_class ["anchor"]] []
617- * ; *)
618622 O. code
619623 ((if mutable_ then O. keyword " mutable" ++ O. txt " " else O. noop)
620624 ++ O. txt name
621625 ++ O. txt Syntax.Type. annotation_separator
622626 ++ type_expr typ
627+ ++ Modalities. format modalities
623628 ++ O. txt Syntax.Type.Record. field_separator)
624- (* ] *)
625629 in
626630 (url, attrs, cell)
627631 in
@@ -630,7 +634,9 @@ module Make (Syntax : SYNTAX) = struct
630634 |> List. map (fun fld ->
631635 let open Odoc_model.Lang.TypeDecl.Field in
632636 let url, attrs, code =
633- field fld.mutable_ (fld.id :> Paths.Identifier.t ) fld.type_
637+ field fld.mutable_
638+ (fld.id :> Paths.Identifier.t )
639+ fld.type_ fld.modalities
634640 in
635641 let anchor = Some url in
636642 let doc = fld.doc.elements in
@@ -708,7 +714,9 @@ module Make (Syntax : SYNTAX) = struct
708714 | Tuple lst ->
709715 let params =
710716 O. list lst ~sep: Syntax.Type.Tuple. element_separator
711- ~f: (type_expr ~needs_parentheses: is_gadt)
717+ ~f: (fun (te , mods ) ->
718+ type_expr ~needs_parentheses: is_gadt te
719+ ++ Modalities. format mods)
712720 in
713721 O. documentedSrc
714722 (cstr
@@ -1058,6 +1066,7 @@ module Make (Syntax : SYNTAX) = struct
10581066 ++ O. txt " " ++ O. txt name
10591067 ++ O. txt Syntax.Type. annotation_separator
10601068 ++ O. cut ++ type_expr t.type_
1069+ ++ Modalities. format t.modalities
10611070 ++ if semicolon then O. txt " ;" else O. noop)
10621071 in
10631072 let attr = [ " value" ] @ extra_attr in
0 commit comments