···2424val list : t -> t
2525val constr : ?value:t -> string -> t
2626val record : (string * t) list -> t
2727-val from_repr : Repr.t -> t
28272928(** {1 Utils} *)
30293030+val from_repr : Repr.t -> t
3131val equal : t -> t -> bool
3232val to_string : t -> string
+109
test/pidgin/kind_test.ml
···1111 repr |> dump_kind;
1212 [%expect {| unit |}]
1313;;
1414+1515+let%expect_test "kind of bool" =
1616+ let repr = Repr.bool true in
1717+ repr |> dump_kind;
1818+ [%expect {| bool |}]
1919+;;
2020+2121+let%expect_test "kind of int" =
2222+ let repr = Repr.int 42 in
2323+ repr |> dump_kind;
2424+ [%expect {| int |}]
2525+;;
2626+2727+let%expect_test "kind of int64" =
2828+ let repr = Repr.int64 42L in
2929+ repr |> dump_kind;
3030+ [%expect {| int64 |}]
3131+;;
3232+3333+let%expect_test "kind of float" =
3434+ let repr = Repr.float 42.2 in
3535+ repr |> dump_kind;
3636+ [%expect {| float |}]
3737+;;
3838+3939+let%expect_test "kind of char" =
4040+ let repr = Repr.char '0' in
4141+ repr |> dump_kind;
4242+ [%expect {| char |}]
4343+;;
4444+4545+let%expect_test "kind of string" =
4646+ let repr = Repr.string "Hello World" in
4747+ repr |> dump_kind;
4848+ [%expect {| string |}]
4949+;;
5050+5151+let%expect_test "kind of pair" =
5252+ let repr = Repr.(pair int int) 42 32 in
5353+ repr |> dump_kind;
5454+ [%expect {| int * int |}]
5555+;;
5656+5757+let%expect_test "kind of pair" =
5858+ let repr = Repr.(pair int string) 42 "foo" in
5959+ repr |> dump_kind;
6060+ [%expect {| int * string |}]
6161+;;
6262+6363+let%expect_test "kind of pair" =
6464+ let repr = Repr.(quad int string bool unit) 42 "foo" false () in
6565+ repr |> dump_kind;
6666+ [%expect {| int * string * bool * unit |}]
6767+;;
6868+6969+let%expect_test "kind of list" =
7070+ let repr = Repr.(list int) [ 42; 32; 12343; 32 ] in
7171+ repr |> dump_kind;
7272+ [%expect {| list(int) |}]
7373+;;
7474+7575+let%expect_test "kind of list" =
7676+ let repr =
7777+ Repr.(Lit.list)
7878+ Repr.[ int 42; float 32.; string "Hello"; string "hello"; int 23 ]
7979+ in
8080+ repr |> dump_kind;
8181+ [%expect {| list(string | int | float) |}]
8282+;;
8383+8484+let%expect_test "kind of record" =
8585+ let repr =
8686+ let open Repr in
8787+ record [ "foo", string "Hello"; "bar", int 22 ]
8888+ in
8989+ repr |> dump_kind;
9090+ [%expect {| record{ [bar] int; [foo] string } |}]
9191+;;
9292+9393+let%expect_test "kind of record" =
9494+ let repr =
9595+ let open Repr in
9696+ record [ "foo", string "Hello"; "bar", int 22; "baz", Lit.list [] ]
9797+ in
9898+ repr |> dump_kind;
9999+ [%expect {| record{ [bar] int; [baz] list(any); [foo] string } |}]
100100+;;
101101+102102+let%expect_test "kind of record" =
103103+ let repr =
104104+ let open Repr in
105105+ record
106106+ [ "foo", string "Hello"
107107+ ; "bar", int 22
108108+ ; ( "baz"
109109+ , Lit.list
110110+ [ int 42
111111+ ; float 32.
112112+ ; string "Hello"
113113+ ; string "hello"
114114+ ; int 23
115115+ ; unit ()
116116+ ] )
117117+ ]
118118+ in
119119+ repr |> dump_kind;
120120+ [%expect
121121+ {| record{ [bar] int; [baz] list(unit | string | int | float); [foo] string } |}]
122122+;;