/
test.atd
49 lines (41 loc) · 956 Bytes
/
test.atd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
(* Sum (enum) *)
type e = [ Alpha | Beta ]
(* Sum *)
type sample_sum = [
| Simple_tag
| Bool of bool
| Int of int
| Float of float
| String <java name="S"> of string
| Simple_record of simple_record
| Complex_record of complex_record
| Record_with_defaults of record_with_defaults
]
(* Record *)
type complex_record = {
b <doc text="foo bar baz"> : bool;
i : int;
s : string;
l : bool list;
sample_sum : sample_sum;
(* Java keywords used as field names *)
?class : int option;
?final <java name="is_final"> : int option;
(* List of records *)
l2 : record_with_defaults list;
}
<doc text="wibble">
(* Record with default fields *)
type record_with_defaults = {
~b : bool;
~i : int;
~s : string;
~o : bool option;
~l : bool list;
~e : e;
}
(* Record with optional field *)
type simple_record = { ?o : bool option }
(* https://github.com/esperco/atdj/issues/2 *)
type a = [ A of b list ]
type b = [ B ]