summaryrefslogtreecommitdiff
path: root/doc/examples/exn.sail
blob: de97e3f9caf3720f93c3f615bd0e00efeffe6dfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
val print = {ocaml: "print_endline"} : string -> unit

scattered union exception

union clause exception = Epair : (range(0, 255), range(0, 255))

union clause exception = Eunknown : string

function main() : unit -> unit = {
  try {
    throw(Eunknown("foo"))
  } catch {
    Eunknown(msg) => print(msg),
    _ => exit()
  }
}

union clause exception = Eint : int

end exception