-
Notifications
You must be signed in to change notification settings - Fork 57
/
everything.atd
86 lines (71 loc) · 2.04 KB
/
everything.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<dlang import="std.stdint : uint32_t, uint16_t">
type kind = [
| Root (* class name conflict *)
| Thing of int
| WOW <json name="wow">
| Amaze <json name="!!!"> of string list
]
type frozen = [
| A
| B of int
]
type ('a, 'b) parametrized_record = {
field_a: 'a;
~field_b: 'b list;
}
type 'a parametrized_tuple = ('a * 'a * int)
type root = {
id <json name="ID">: string;
await: bool;
integer: int;
__init__ : float;
~float_with_auto_default: float;
~float_with_default <dlang default="0.1">: float;
items: int list list;
?maybe: int option;
~extras: int list;
~answer <dlang default="42">: int;
aliased: alias;
point: (float * float);
kind: kind;
kinds: kind list;
assoc1: (float * int) list;
assoc2: (string * int) list <json repr="object">;
assoc3: (float * int) list <dlang repr="dict">;
assoc4: (string * int) list <json repr="object"> <dlang repr="dict">;
nullables: int nullable list;
options: int option list;
untyped_things: abstract list;
parametrized_record: (int, float) parametrized_record;
parametrized_tuple: kind parametrized_tuple;
wrapped: st wrap <dlang t="uint16_t" wrap="((St st) => st.to!int.to!uint16_t)" unwrap="((uint16_t e) => St(e.to!int))">;
aaa: alias_of_alias_of_alias;
}
type st = int
type alias = int list
type alias2 = int list
type alias3 = int wrap <dlang t="uint32_t" wrap="to!uint32_t" unwrap="to!int">
type alias_of_alias = alias3 wrap <dlang t="uint16_t" wrap="to!uint16_t" unwrap="to!uint32_t">
type alias_of_alias_not_Wrapped = alias3
type alias_of_alias_of_alias = alias_of_alias_not_Wrapped
type password = int wrap <dlang t="uint32_t" wrap="to!uint32_t" unwrap="to!int">
type credential = {
name: string;
password: password;
}
type credentials = credential list
type pair = (string * int)
type require_field = {
req: string;
}
type recursive_class = {
id: int;
flag: bool;
children: recursive_class list;
}
type default_list = {
~items: int list;
}
type record_with_wrapped_type = {
item: string wrap <dlang t="int" wrap="to!int" unwrap="to!string">;
}