@@ -1034,13 +1034,39 @@ module Fmt = struct
1034
1034
Format. fprintf ppf " %a.%s" resolved_parent_path p
1035
1035
(Odoc_model.Names.TypeName. to_string t)
1036
1036
1037
+ and resolved_datatype_path :
1038
+ Format. formatter -> Cpath.Resolved. datatype -> unit =
1039
+ fun ppf p ->
1040
+ match p with
1041
+ | `Local id -> Format. fprintf ppf " %a" Ident. fmt id
1042
+ | `Gpath p ->
1043
+ Format. fprintf ppf " %a" model_resolved_path
1044
+ (p :> Odoc_model.Paths.Path.Resolved.t )
1045
+ | `Substituted x ->
1046
+ Format. fprintf ppf " substituted(%a)" resolved_datatype_path x
1047
+ | `CanonicalDataType (t1 , t2 ) ->
1048
+ Format. fprintf ppf " canonicalty(%a,%a)" resolved_datatype_path t1
1049
+ model_path
1050
+ (t2 :> Odoc_model.Paths.Path.t )
1051
+ | `Type (p , t ) ->
1052
+ Format. fprintf ppf " %a.%s" resolved_parent_path p
1053
+ (Odoc_model.Names.TypeName. to_string t)
1054
+
1037
1055
and resolved_value_path : Format.formatter -> Cpath.Resolved.value -> unit =
1038
1056
fun ppf p ->
1039
1057
match p with
1040
1058
| `Value (p , t ) ->
1041
1059
Format. fprintf ppf " %a.%s" resolved_parent_path p
1042
1060
(Odoc_model.Names.ValueName. to_string t)
1043
1061
1062
+ and resolved_constructor_path :
1063
+ Format. formatter -> Cpath.Resolved. constructor -> unit =
1064
+ fun ppf p ->
1065
+ match p with
1066
+ | `Constructor (p , t ) ->
1067
+ Format. fprintf ppf " %a.%s" resolved_datatype_path p
1068
+ (Odoc_model.Names.ConstructorName. to_string t)
1069
+
1044
1070
and resolved_parent_path : Format.formatter -> Cpath.Resolved.parent -> unit =
1045
1071
fun ppf p ->
1046
1072
match p with
@@ -1069,6 +1095,21 @@ module Fmt = struct
1069
1095
Format. fprintf ppf " %a.%s" resolved_parent_path p
1070
1096
(Odoc_model.Names.TypeName. to_string t)
1071
1097
1098
+ and datatype_path : Format.formatter -> Cpath.datatype -> unit =
1099
+ fun ppf p ->
1100
+ match p with
1101
+ | `Resolved r -> Format. fprintf ppf " r(%a)" resolved_datatype_path r
1102
+ | `Identifier (id , b ) ->
1103
+ Format. fprintf ppf " identifier(%a, %b)" model_identifier
1104
+ (id :> Odoc_model.Paths.Identifier.t )
1105
+ b
1106
+ | `Local (id , b ) -> Format. fprintf ppf " local(%a,%b)" Ident. fmt id b
1107
+ | `Substituted s -> Format. fprintf ppf " substituted(%a)" datatype_path s
1108
+ | `Dot (m , s ) -> Format. fprintf ppf " %a.%s" module_path m s
1109
+ | `Type (p , t ) ->
1110
+ Format. fprintf ppf " %a.%s" resolved_parent_path p
1111
+ (Odoc_model.Names.TypeName. to_string t)
1112
+
1072
1113
and value_path : Format.formatter -> Cpath.value -> unit =
1073
1114
fun ppf p ->
1074
1115
match p with
@@ -1078,6 +1119,15 @@ module Fmt = struct
1078
1119
Format. fprintf ppf " %a.%s" resolved_parent_path p
1079
1120
(Odoc_model.Names.ValueName. to_string t)
1080
1121
1122
+ and constructor_path : Format.formatter -> Cpath.constructor -> unit =
1123
+ fun ppf p ->
1124
+ match p with
1125
+ | `Resolved r -> Format. fprintf ppf " r(%a)" resolved_constructor_path r
1126
+ | `Dot (m , s ) -> Format. fprintf ppf " %a.%s" datatype_path m s
1127
+ | `Constructor (p , t ) ->
1128
+ Format. fprintf ppf " %a.%s" resolved_datatype_path p
1129
+ (Odoc_model.Names.ConstructorName. to_string t)
1130
+
1081
1131
and resolved_class_type_path :
1082
1132
Format. formatter -> Cpath.Resolved. class_type -> unit =
1083
1133
fun ppf p ->
@@ -1151,6 +1201,10 @@ module Fmt = struct
1151
1201
Format. fprintf ppf " %a.%s" model_resolved_path
1152
1202
(parent :> t )
1153
1203
(Odoc_model.Names.TypeName. to_string name)
1204
+ | `Constructor (parent , name ) ->
1205
+ Format. fprintf ppf " %a.%s" model_resolved_path
1206
+ (parent :> t )
1207
+ (Odoc_model.Names.ConstructorName. to_string name)
1154
1208
| `Value (parent , name ) ->
1155
1209
Format. fprintf ppf " %a.%s" model_resolved_path
1156
1210
(parent :> t )
@@ -1185,6 +1239,11 @@ module Fmt = struct
1185
1239
(t1 :> t )
1186
1240
model_path
1187
1241
(t2 :> Odoc_model.Paths.Path.t )
1242
+ | `CanonicalDataType (t1 , t2 ) ->
1243
+ Format. fprintf ppf " canonicaldaty(%a,%a)" model_resolved_path
1244
+ (t1 :> t )
1245
+ model_path
1246
+ (t2 :> Odoc_model.Paths.Path.t )
1188
1247
| `Apply (funct , arg ) ->
1189
1248
Format. fprintf ppf " %a(%a)" model_resolved_path
1190
1249
(funct :> t )
@@ -1796,11 +1855,31 @@ module Of_Lang = struct
1796
1855
| `ClassType (p , name ) ->
1797
1856
`ClassType (`Module (resolved_module_path ident_map p), name)
1798
1857
1858
+ and resolved_datatype_path :
1859
+ _ -> Odoc_model.Paths.Path.Resolved.DataType. t -> Cpath.Resolved. datatype
1860
+ =
1861
+ fun ident_map p ->
1862
+ match p with
1863
+ | `Identifier i -> (
1864
+ match identifier Maps.Type. find ident_map.types i with
1865
+ | `Local l -> `Local l
1866
+ | `Identifier _ -> `Gpath p)
1867
+ | `CanonicalDataType (p1 , p2 ) ->
1868
+ `CanonicalDataType (resolved_datatype_path ident_map p1, p2)
1869
+ | `Type (p , name ) -> `Type (`Module (resolved_module_path ident_map p), name)
1870
+
1799
1871
and resolved_value_path :
1800
1872
_ -> Odoc_model.Paths.Path.Resolved.Value. t -> Cpath.Resolved. value =
1801
1873
fun ident_map (`Value (p , name )) ->
1802
1874
`Value (`Module (resolved_module_path ident_map p), name)
1803
1875
1876
+ and resolved_constructor_path :
1877
+ _ ->
1878
+ Odoc_model.Paths.Path.Resolved.Constructor. t ->
1879
+ Cpath.Resolved. constructor =
1880
+ fun ident_map (`Constructor (p , name )) ->
1881
+ `Constructor (resolved_datatype_path ident_map p, name)
1882
+
1804
1883
and resolved_class_type_path :
1805
1884
_ ->
1806
1885
Odoc_model.Paths.Path.Resolved.ClassType. t ->
@@ -1859,6 +1938,23 @@ module Of_Lang = struct
1859
1938
| `Resolved r -> `Resolved (resolved_value_path ident_map r)
1860
1939
| `Dot (path' , x ) -> `Dot (module_path ident_map path', x)
1861
1940
1941
+ and datatype : _ -> Odoc_model.Paths.Path.DataType.t -> Cpath.datatype =
1942
+ fun ident_map p ->
1943
+ match p with
1944
+ | `Resolved r -> `Resolved (resolved_datatype_path ident_map r)
1945
+ | `Identifier (i , b ) -> (
1946
+ match identifier Maps.Type. find ident_map.types i with
1947
+ | `Identifier i -> `Identifier (i, b)
1948
+ | `Local i -> `Local (i, b))
1949
+ | `Dot (path' , x ) -> `Dot (module_path ident_map path', x)
1950
+
1951
+ and constructor_path :
1952
+ _ -> Odoc_model.Paths.Path.Constructor. t -> Cpath. constructor =
1953
+ fun ident_map p ->
1954
+ match p with
1955
+ | `Resolved r -> `Resolved (resolved_constructor_path ident_map r)
1956
+ | `Dot (path' , x ) -> `Dot (datatype ident_map path', x)
1957
+
1862
1958
and class_type_path :
1863
1959
_ -> Odoc_model.Paths.Path.ClassType. t -> Cpath. class_type =
1864
1960
fun ident_map p ->
0 commit comments