| 1 | open! Base |
| 2 | |
| 3 | module Abstract : sig |
| 4 | type t [@@deriving_inline sexp] |
| 5 | |
| 6 | include sig |
| 7 | [@@@ocaml.warning "-32"] |
| 8 | |
| 9 | include Sexplib0.Sexpable.S with type t := t |
| 10 | end |
| 11 | [@@ocaml.doc "@inline"] |
| 12 | |
| 13 | [@@@end] |
| 14 | end |
| 15 | |
| 16 | module Tuple : sig |
| 17 | type t = int * int * int [@@deriving_inline sexp] |
| 18 | |
| 19 | include sig |
| 20 | [@@@ocaml.warning "-32"] |
| 21 | |
| 22 | include Sexplib0.Sexpable.S with type t := t |
| 23 | end |
| 24 | [@@ocaml.doc "@inline"] |
| 25 | |
| 26 | [@@@end] |
| 27 | end |
| 28 | |
| 29 | module Record : sig |
| 30 | type t = |
| 31 | { a : int |
| 32 | ; b : int |
| 33 | ; c : int |
| 34 | } |
| 35 | [@@deriving_inline sexp] |
| 36 | |
| 37 | include sig |
| 38 | [@@@ocaml.warning "-32"] |
| 39 | |
| 40 | include Sexplib0.Sexpable.S with type t := t |
| 41 | end |
| 42 | [@@ocaml.doc "@inline"] |
| 43 | |
| 44 | [@@@end] |
| 45 | end |
| 46 | |
| 47 | module Mutable_record : sig |
| 48 | type t = |
| 49 | { mutable a : int |
| 50 | ; mutable b : int |
| 51 | ; mutable c : int |
| 52 | } |
| 53 | [@@deriving_inline sexp] |
| 54 | |
| 55 | include sig |
| 56 | [@@@ocaml.warning "-32"] |
| 57 | |
| 58 | include Sexplib0.Sexpable.S with type t := t |
| 59 | end |
| 60 | [@@ocaml.doc "@inline"] |
| 61 | |
| 62 | [@@@end] |
| 63 | end |
| 64 | |
| 65 | module Variant : sig |
| 66 | type t = |
| 67 | | A |
| 68 | | B of int * int |
| 69 | | C of |
| 70 | { a : int |
| 71 | ; b : int |
| 72 | ; d : int |
| 73 | } |
| 74 | | D of |
| 75 | { mutable a : int |
| 76 | ; mutable b : int |
| 77 | ; mutable t : int |
| 78 | } |
| 79 | [@@deriving_inline sexp] |
| 80 | |
| 81 | include sig |
| 82 | [@@@ocaml.warning "-32"] |
| 83 | |
| 84 | include Sexplib0.Sexpable.S with type t := t |
| 85 | end |
| 86 | [@@ocaml.doc "@inline"] |
| 87 | |
| 88 | [@@@end] |
| 89 | end |
| 90 | |
| 91 | module Poly_variant : sig |
| 92 | type t = |
| 93 | [ `A |
| 94 | | `B of int |
| 95 | ] |
| 96 | [@@deriving_inline sexp] |
| 97 | |
| 98 | include sig |
| 99 | [@@@ocaml.warning "-32"] |
| 100 | |
| 101 | val sexp_of_t : t -> Sexplib0.Sexp.t |
| 102 | val t_of_sexp : Sexplib0.Sexp.t -> t |
| 103 | val __t_of_sexp__ : Sexplib0.Sexp.t -> t |
| 104 | end |
| 105 | [@@ocaml.doc "@inline"] |
| 106 | |
| 107 | [@@@end] |
| 108 | end |
| 109 | |
| 110 | module Inline_poly_variant : sig |
| 111 | type t = |
| 112 | [ Poly_variant.t |
| 113 | | `C of int * int |
| 114 | ] |
| 115 | [@@deriving_inline sexp] |
| 116 | |
| 117 | include sig |
| 118 | [@@@ocaml.warning "-32"] |
| 119 | |
| 120 | val sexp_of_t : t -> Sexplib0.Sexp.t |
| 121 | val t_of_sexp : Sexplib0.Sexp.t -> t |
| 122 | val __t_of_sexp__ : Sexplib0.Sexp.t -> t |
| 123 | end |
| 124 | [@@ocaml.doc "@inline"] |
| 125 | |
| 126 | [@@@end] |
| 127 | end |
| 128 | |
| 129 | module Recursive : sig |
| 130 | type t = |
| 131 | | Banana of t |
| 132 | | Orange |
| 133 | [@@deriving_inline sexp] |
| 134 | |
| 135 | include sig |
| 136 | [@@@ocaml.warning "-32"] |
| 137 | |
| 138 | include Sexplib0.Sexpable.S with type t := t |
| 139 | end |
| 140 | [@@ocaml.doc "@inline"] |
| 141 | |
| 142 | [@@@end] |
| 143 | end |
| 144 | |
| 145 | module Nonrecursive : sig |
| 146 | open Recursive |
| 147 | |
| 148 | type nonrec t = t [@@deriving_inline sexp] |
| 149 | |
| 150 | include sig |
| 151 | [@@@ocaml.warning "-32"] |
| 152 | |
| 153 | include Sexplib0.Sexpable.S with type t := t |
| 154 | end |
| 155 | [@@ocaml.doc "@inline"] |
| 156 | |
| 157 | [@@@end] |
| 158 | end |
| 159 | |
| 160 | module Mutually_recursive : sig |
| 161 | type a = |
| 162 | | A |
| 163 | | B of b |
| 164 | | C of |
| 165 | { a : a |
| 166 | ; b : b |
| 167 | ; c : c |
| 168 | } |
| 169 | |
| 170 | and b = |
| 171 | { a : a |
| 172 | ; b : b |
| 173 | } |
| 174 | |
| 175 | and c = a [@@deriving_inline sexp] |
| 176 | |
| 177 | include sig |
| 178 | [@@@ocaml.warning "-32"] |
| 179 | |
| 180 | val sexp_of_a : a -> Sexplib0.Sexp.t |
| 181 | val sexp_of_b : b -> Sexplib0.Sexp.t |
| 182 | val sexp_of_c : c -> Sexplib0.Sexp.t |
| 183 | val a_of_sexp : Sexplib0.Sexp.t -> a |
| 184 | val b_of_sexp : Sexplib0.Sexp.t -> b |
| 185 | val c_of_sexp : Sexplib0.Sexp.t -> c |
| 186 | end |
| 187 | [@@ocaml.doc "@inline"] |
| 188 | |
| 189 | [@@@end] |
| 190 | end |
| 191 | |
| 192 | module Alias : sig |
| 193 | type t = Recursive.t [@@deriving_inline sexp] |
| 194 | |
| 195 | include sig |
| 196 | [@@@ocaml.warning "-32"] |
| 197 | |
| 198 | include Sexplib0.Sexpable.S with type t := t |
| 199 | end |
| 200 | [@@ocaml.doc "@inline"] |
| 201 | |
| 202 | [@@@end] |
| 203 | end |
| 204 | |
| 205 | module Re_export : sig |
| 206 | type t = Recursive.t = |
| 207 | | Banana of t |
| 208 | | Orange |
| 209 | [@@deriving_inline sexp] |
| 210 | |
| 211 | include sig |
| 212 | [@@@ocaml.warning "-32"] |
| 213 | |
| 214 | include Sexplib0.Sexpable.S with type t := t |
| 215 | end |
| 216 | [@@ocaml.doc "@inline"] |
| 217 | |
| 218 | [@@@end] |
| 219 | end |
| 220 | |
| 221 | module Unary : sig |
| 222 | type 'a t = 'a list option [@@deriving_inline sexp] |
| 223 | |
| 224 | include sig |
| 225 | [@@@ocaml.warning "-32"] |
| 226 | |
| 227 | include Sexplib0.Sexpable.S1 with type 'a t := 'a t |
| 228 | end |
| 229 | [@@ocaml.doc "@inline"] |
| 230 | |
| 231 | [@@@end] |
| 232 | end |
| 233 | |
| 234 | module Binary : sig |
| 235 | type ('a, 'b) t = ('a, 'b) Either.t [@@deriving_inline sexp] |
| 236 | |
| 237 | include sig |
| 238 | [@@@ocaml.warning "-32"] |
| 239 | |
| 240 | include Sexplib0.Sexpable.S2 with type ('a, 'b) t := ('a, 'b) t |
| 241 | end |
| 242 | [@@ocaml.doc "@inline"] |
| 243 | |
| 244 | [@@@end] |
| 245 | end |
| 246 | |
| 247 | module First_order : sig |
| 248 | type 'a t = 'a -> 'a [@@deriving_inline sexp] |
| 249 | |
| 250 | include sig |
| 251 | [@@@ocaml.warning "-32"] |
| 252 | |
| 253 | include Sexplib0.Sexpable.S1 with type 'a t := 'a t |
| 254 | end |
| 255 | [@@ocaml.doc "@inline"] |
| 256 | |
| 257 | [@@@end] |
| 258 | end |
| 259 | |
| 260 | module Second_order : sig |
| 261 | type ('a, 'b) t = ('a -> 'a) -> ('a -> 'b) -> ('b -> 'b) -> 'a -> 'b |
| 262 | [@@deriving_inline sexp] |
| 263 | |
| 264 | include sig |
| 265 | [@@@ocaml.warning "-32"] |
| 266 | |
| 267 | include Sexplib0.Sexpable.S2 with type ('a, 'b) t := ('a, 'b) t |
| 268 | end |
| 269 | [@@ocaml.doc "@inline"] |
| 270 | |
| 271 | [@@@end] |
| 272 | end |
| 273 | |
| 274 | module Named_arguments : sig |
| 275 | type t = ?a:int -> b:int -> int -> int [@@deriving_inline sexp] |
| 276 | |
| 277 | include sig |
| 278 | [@@@ocaml.warning "-32"] |
| 279 | |
| 280 | include Sexplib0.Sexpable.S with type t := t |
| 281 | end |
| 282 | [@@ocaml.doc "@inline"] |
| 283 | |
| 284 | [@@@end] |
| 285 | end |
| 286 | |
| 287 | module Gadt : sig |
| 288 | type _ t = |
| 289 | | A : _ option t |
| 290 | | B : int -> int t |
| 291 | | C : 'a list -> unit t |
| 292 | [@@deriving_inline sexp_of] |
| 293 | |
| 294 | include sig |
| 295 | [@@@ocaml.warning "-32"] |
| 296 | |
| 297 | val sexp_of_t : ('a__001_ -> Sexplib0.Sexp.t) -> 'a__001_ t -> Sexplib0.Sexp.t |
| 298 | end |
| 299 | [@@ocaml.doc "@inline"] |
| 300 | |
| 301 | [@@@end] |
| 302 | end |
| 303 | |
| 304 | module Recursive_record_containing_variant : sig |
| 305 | type t = |
| 306 | { a : [ `A of t ] |
| 307 | ; b : [ `B ] |
| 308 | } |
| 309 | [@@deriving_inline sexp] |
| 310 | |
| 311 | include sig |
| 312 | [@@@ocaml.warning "-32"] |
| 313 | |
| 314 | include Sexplib0.Sexpable.S with type t := t |
| 315 | end |
| 316 | [@@ocaml.doc "@inline"] |
| 317 | |
| 318 | [@@@end] |
| 319 | end |
| 320 | |
| 321 | module Poly_record : sig |
| 322 | type t = |
| 323 | { a : 'a. 'a list |
| 324 | ; b : 'b. 'b option |
| 325 | ; c : 'c. 'c |
| 326 | } |
| 327 | [@@deriving_inline sexp] |
| 328 | |
| 329 | include sig |
| 330 | [@@@ocaml.warning "-32"] |
| 331 | |
| 332 | include Sexplib0.Sexpable.S with type t := t |
| 333 | end |
| 334 | [@@ocaml.doc "@inline"] |
| 335 | |
| 336 | [@@@end] |
| 337 | end |
| 338 | |
| 339 | module Record_with_defaults : sig |
| 340 | type t = |
| 341 | { a : int |
| 342 | ; b : int |
| 343 | ; c : int |
| 344 | ; d : int |
| 345 | ; e : int |
| 346 | ; f : int |
| 347 | } |
| 348 | [@@deriving_inline sexp] |
| 349 | |
| 350 | include sig |
| 351 | [@@@ocaml.warning "-32"] |
| 352 | |
| 353 | include Sexplib0.Sexpable.S with type t := t |
| 354 | end |
| 355 | [@@ocaml.doc "@inline"] |
| 356 | |
| 357 | [@@@end] |
| 358 | end |
| 359 | |
| 360 | module Record_with_special_types : sig |
| 361 | type t = |
| 362 | { a : int option |
| 363 | ; b : int list |
| 364 | ; c : int array |
| 365 | ; d : bool |
| 366 | } |
| 367 | [@@deriving_inline sexp] |
| 368 | |
| 369 | include sig |
| 370 | [@@@ocaml.warning "-32"] |
| 371 | |
| 372 | include Sexplib0.Sexpable.S with type t := t |
| 373 | end |
| 374 | [@@ocaml.doc "@inline"] |
| 375 | |
| 376 | [@@@end] |
| 377 | end |
| 378 | |
| 379 | module Record_with_omit_nil : sig |
| 380 | type t = |
| 381 | { a : int option |
| 382 | ; b : int list |
| 383 | ; c : unit |
| 384 | ; d : int |
| 385 | } |
| 386 | [@@deriving_inline sexp] |
| 387 | |
| 388 | include sig |
| 389 | [@@@ocaml.warning "-32"] |
| 390 | |
| 391 | include Sexplib0.Sexpable.S with type t := t |
| 392 | end |
| 393 | [@@ocaml.doc "@inline"] |
| 394 | |
| 395 | [@@@end] |
| 396 | end |
| 397 | |
| 398 | module Variant_with_sexp_list : sig |
| 399 | type t = A of int list [@@deriving_inline sexp] |
| 400 | |
| 401 | include sig |
| 402 | [@@@ocaml.warning "-32"] |
| 403 | |
| 404 | include Sexplib0.Sexpable.S with type t := t |
| 405 | end |
| 406 | [@@ocaml.doc "@inline"] |
| 407 | |
| 408 | [@@@end] |
| 409 | end |
| 410 | |
| 411 | module Poly_variant_with_sexp_list : sig |
| 412 | type t = [ `A of int list ] [@@deriving_inline sexp] |
| 413 | |
| 414 | include sig |
| 415 | [@@@ocaml.warning "-32"] |
| 416 | |
| 417 | val sexp_of_t : t -> Sexplib0.Sexp.t |
| 418 | val t_of_sexp : Sexplib0.Sexp.t -> t |
| 419 | val __t_of_sexp__ : Sexplib0.Sexp.t -> t |
| 420 | end |
| 421 | [@@ocaml.doc "@inline"] |
| 422 | |
| 423 | [@@@end] |
| 424 | end |
| 425 | |
| 426 | module Record_allowing_extra_fields : sig |
| 427 | type t = { a : int } [@@deriving_inline sexp] |
| 428 | |
| 429 | include sig |
| 430 | [@@@ocaml.warning "-32"] |
| 431 | |
| 432 | include Sexplib0.Sexpable.S with type t := t |
| 433 | end |
| 434 | [@@ocaml.doc "@inline"] |
| 435 | |
| 436 | [@@@end] |
| 437 | end |
| 438 | |
| 439 | module Opaque : sig |
| 440 | type t = int list [@@deriving_inline sexp] |
| 441 | |
| 442 | include sig |
| 443 | [@@@ocaml.warning "-32"] |
| 444 | |
| 445 | include Sexplib0.Sexpable.S with type t := t |
| 446 | end |
| 447 | [@@ocaml.doc "@inline"] |
| 448 | |
| 449 | [@@@end] |
| 450 | end |