mirror of
https://github.com/anoma/juvix.git
synced 2024-12-04 06:23:13 +03:00
44cdd8404b
- Closes #2801
33 lines
598 B
Plaintext
33 lines
598 B
Plaintext
module RecordPattern;
|
|
|
|
type Pair (A B : Type) :=
|
|
mkPair {
|
|
fst : A;
|
|
snd : B
|
|
};
|
|
|
|
type T := t;
|
|
|
|
partialMatch : Pair T T -> T
|
|
| mypair@mkPair@{snd := t} := t;
|
|
|
|
swap {A B : Type} : Pair A B -> Pair B A
|
|
| mkPair@{fst := c1; snd := c2} := mkPair c2 c1;
|
|
|
|
swapPun {A B : Type} : Pair A B -> Pair B A
|
|
| mkPair@{fst; snd} := mkPair snd fst;
|
|
|
|
type Sum (A B : Type) :=
|
|
| inj1 {
|
|
fst : A;
|
|
snd : B
|
|
}
|
|
| inj2 {
|
|
fst : A;
|
|
snd2 : B
|
|
};
|
|
|
|
sumSwap {A B : Type} : Sum A B -> Sum B A
|
|
| inj1@{fst; snd := y} := inj2 y fst
|
|
| inj2@{snd2 := y; fst := fst} := inj1 y fst;
|