-
Notifications
You must be signed in to change notification settings - Fork 58
/
Copy pathReprod.res
56 lines (40 loc) · 1.25 KB
/
Reprod.res
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
module Query = {
let use = (~variables: QueryFile.Types.variables) => {
ignore(variables)
""
}
}
// let x = Query.use(~variables={location: ByAddress()})
// ^com
type nestedRecord = {nested: bool}
type rec someRecord = {
first: int,
second: (bool, option<someRecord>),
optThird: option<[#first | #second(someRecord)]>,
nest: nestedRecord,
}
type somePolyVariant = [#one | #two(bool) | #three(someRecord, bool)]
type someVariant = One | Two(bool) | Three(someRecord, bool)
type paramRecord<'a, 'b> = {
first: 'a,
second: 'b,
}
let record: paramRecord<someVariant, QueryFile.Types.byAddress> = {
first: One,
second: {city: "city"},
}
// switch record { | {first: }}
// ^com
// switch record { | {second: }}
// ^com
// TODO: Functions, aliases/definitions, records, variants, polyvariants, tuples
let res: result<someVariant, somePolyVariant> = Ok(One)
// switch res { | Ok() }
// ^com
// switch res { | Error() }
// ^com
let resOpt: result<option<someVariant>, unit> = Ok(None)
// switch resOpt { | Ok() }
// ^com
// switch resOpt { | Ok(Some()) }
// ^com