Debian Codegraph @

test/sexp_grammar/test_gadt.ml

raw symbols SCIP
1 open! Base
2
3 type t = T : ('a[@sexp.opaque]) -> t [@@deriving sexp] [@@deriving_inline sexp_grammar]
4
5 let _ = fun (_ : t) -> ()
6
7 let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) =
8 { untyped =
9 Lazy
10 (lazy
11 (Variant
12 { case_sensitivity = Case_sensitive_except_first_character
13 ; clauses =
14 [ No_tag
15 { name = "T"
16 ; clause_kind =
17 List_clause
18 { args =
19 Cons (Sexplib0.Sexp_conv.opaque_sexp_grammar.untyped, Empty)
20 }
21 }
22 ]
23 }))
24 }
25 ;;
26
27 let _ = t_sexp_grammar
28
29 [@@@end]
30
31 type nullary = Nullary : nullary [@@deriving sexp] [@@deriving_inline sexp_grammar]
32
33 let _ = fun (_ : nullary) -> ()
34
35 let (nullary_sexp_grammar : nullary Sexplib0.Sexp_grammar.t) =
36 { untyped =
37 Variant
38 { case_sensitivity = Case_sensitive_except_first_character
39 ; clauses = [ No_tag { name = "Nullary"; clause_kind = Atom_clause } ]
40 }
41 }
42 ;;
43
44 let _ = nullary_sexp_grammar
45
46 [@@@end]
47
48 (* We can't derive [of_sexp], but we can derive a sensible grammar for this type. *)
49 type _ grammar_only = Grammar_only : int -> string grammar_only
50 [@@warning "-37"] [@@deriving_inline sexp_grammar]
51
52 let _ = fun (_ : _ grammar_only) -> ()
53
54 let grammar_only_sexp_grammar :
55 'a__016_.
56 'a__016_ Sexplib0.Sexp_grammar.t -> 'a__016_ grammar_only Sexplib0.Sexp_grammar.t
57 =
58 fun _'a__016__sexp_grammar ->
59 { untyped =
60 Variant
61 { case_sensitivity = Case_sensitive_except_first_character
62 ; clauses =
63 [ No_tag
64 { name = "Grammar_only"
65 ; clause_kind =
66 List_clause { args = Cons (int_sexp_grammar.untyped, Empty) }
67 }
68 ]
69 }
70 }
71 ;;
72
73 let _ = grammar_only_sexp_grammar
74
75 [@@@end]