blob: 51b14d7c7ea6aad001985c89f65bcd973d4f8a01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use std
type u = union
`Foo
`Bar int
;;
const f = {v : int -> u
-> `Bar v
}
const main = {
var v
v = f(99)
match v
| `Foo: std.exit(1)
| `Bar x: std.exit(x)
;;
std.exit(2)
}
|