1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-12 14:28:08 +03:00
juvix/tests/positive/Internal/Simple.juvix
2023-01-03 14:37:19 +01:00

41 lines
648 B
Plaintext

module Simple;
type T :=
tt : T;
someT : T;
someT := tt;
type Bool :=
false : Bool |
true : Bool;
type Nat :=
zero : Nat |
suc : Nat → Nat;
infix 3 ==;
== : Nat → Nat → Bool;
== zero zero := true;
== (suc a) (suc b) := a == b;
== _ _ := false;
infixl 4 +;
+ : Nat → Nat → Nat;
+ zero b := b;
+ (suc a) b := suc (a + b);
infixr 5 ::;
type List :=
nil : List |
:: : Nat → List → List;
foldr : (Nat → Nat → Nat) → Nat → List → Nat;
foldr _ v nil := v;
foldr f v (a :: as) := f a (foldr f v as);
sum : List → Nat;
sum := foldr (+) zero;
end;