unison/unison-src/tests/pattern-matching2.u
2023-02-27 11:13:10 -05:00

23 lines
360 B
Plaintext

structural type Foo0 = Foo0
structural type Foo1 a = Foo1 a
structural type Foo2 a b = Foo2 a b
structural type Foo3 a b c = Foo3 a b c
use Foo0 Foo0
use Foo1 Foo1
use Foo2 Foo2
x = match Foo0 with
Foo0 -> 1
y = match Foo1 1 with
Foo1 1 -> 0
Foo1 _ -> 10
z = match Foo2 1 "hi" with
Foo2 1 "hi" -> 1
Foo2 x "bye" -> x
_ -> bug "unexpected"
> z