mirror of
https://github.com/anoma/juvix.git
synced 2025-01-05 22:46:08 +03:00
929a8658ac
- Closes #1716 --------- Co-authored-by: Paul Cadman <git@paulcadman.dev>
36 lines
737 B
Plaintext
36 lines
737 B
Plaintext
module Case;
|
|
open import Stdlib.Prelude;
|
|
|
|
isZero : Nat → Bool;
|
|
isZero n := case n
|
|
| zero := true
|
|
| k@(suc _) := false;
|
|
|
|
id' : Bool → {A : Type} → A → A;
|
|
id' b := case b
|
|
| true := id
|
|
| false := id;
|
|
|
|
pred : Nat → Nat;
|
|
pred n := case n
|
|
| zero := zero
|
|
| suc n := n;
|
|
|
|
appIf : {A : Type} → Bool → (A → A) → A → A;
|
|
appIf b f := case b
|
|
| true := f
|
|
| false := id;
|
|
|
|
appIf2 : {A : Type} → Bool → (A → A) → A → A;
|
|
appIf2 b f a := (case b
|
|
| true := f
|
|
| false := id)
|
|
a;
|
|
|
|
nestedCase1 : {A : Type} → Bool → (A → A) → A → A;
|
|
nestedCase1 b f := case b
|
|
| true := (case b
|
|
| _ := id)
|
|
| false := id;
|
|
end;
|