summaryrefslogtreecommitdiff
path: root/test/c/poly_union.sail
blob: ffd51a4ca5cd311e815cfb2c1f34b979af3b9b4e (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
default Order dec

$include <flow.sail>

val print = "print_endline" : string -> unit

union ast = {
  HCF : unit
}

union option ('a : Type) = {
  Some : 'a,
  None : unit
}

val decode : unit -> option(ast)

function decode() = Some(HCF())

val main : unit -> unit

function main() = {
  let instr = decode();
  match instr {
    Some(HCF()) => print("HCF"),
    Some(_) => print("Some(_)"),
    None() => print("None")
  }
}