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

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")
  }
}