blob: fe7e9aeab9520f9dae4ab3fb7c5e0ffa695530e7 (
plain)
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
|
basic, non-generic type declarations
<<<
Person = type {
name string
age uint
address string?
}
Maybe = variant {
Nothing
Just any
}
Error = class {
error() string
}
Result = variant {
Ok any
Error Error
}
Twins = type (Person, Person)
Group = type [Person]
>>>
(expr (binary = (expr (name Person)) (expr (type structure (field name) (type name string) (field age) (type name uint) (field address) (type maybe (type name string))))))
(expr (binary = (expr (name Maybe)) (expr (type variant (variant Nothing) (variant Just of (type name any))))))
(expr (binary = (expr (name Error)) (expr (type class (method error (returns (type name string)))))))
(expr (binary = (expr (name Result)) (expr (type variant (variant Ok of (type name any)) (variant Error of (type name Error))))))
(expr (binary = (expr (name Twins)) (expr (type tuple (type name Person) (type name Person)))))
(expr (binary = (expr (name Group)) (expr (type array of (type name Person)))))
|