unison/unison-src/tests/pattern-matching2.u

23 lines
360 B
Plaintext
Raw Normal View History

2021-08-24 21:33:27 +03:00
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
2018-08-16 18:34:37 +03:00
use Foo0 Foo0
use Foo1 Foo1
use Foo2 Foo2
x = match Foo0 with
2018-08-16 18:34:37 +03:00
Foo0 -> 1
y = match Foo1 1 with
2018-08-16 18:34:37 +03:00
Foo1 1 -> 0
Foo1 _ -> 10
z = match Foo2 1 "hi" with
2018-08-16 18:34:37 +03:00
Foo2 1 "hi" -> 1
Foo2 x "bye" -> x
_ -> bug "unexpected"
2018-08-16 18:34:37 +03:00
2019-03-08 20:56:02 +03:00
> z