1
1
mirror of https://github.com/anoma/juvix.git synced 2025-01-05 22:46:08 +03:00
juvix/tests/positive/Internal/Case.juvix
Łukasz Czajka 019579bba2
Fix case formatting (#2387)
* Closes #2361 
* Aligns `case` and `let`
2023-09-26 10:11:46 +02:00

47 lines
763 B
Plaintext

module Case;
import Stdlib.Prelude open;
isZero : Nat → Bool
| n :=
case n of {
| zero := true
| k@(suc _) := false
};
id' : Bool → {A : Type} → A → A
| b :=
case b of {
| true := id
| false := id
};
pred : Nat → Nat
| n :=
case n of {
| zero := zero
| suc n := n
};
appIf : {A : Type} → Bool → (A → A) → A → A
| b f :=
case b of {
| true := f
| false := id
};
appIf2 : {A : Type} → Bool → (A → A) → A → A
| b f a :=
case b of {
| true := f
| false := id
}
a;
nestedCase1 : {A : Type} → Bool → (A → A) → A → A
| b f :=
case b of {
| true := case b of {_ := id}
| false := id
};