1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-04 17:07:28 +03:00
juvix/tests/positive/Internal/Simple.juvix
Jonathan Cubides 21d5034e60
Fix formatting for all Juvix files in tests folder (#2404)
In this PR, we ran the Juvix formatter so that we can now freely run
`make format`, `make check`, or `make pre-commit` without any unexpected
file changes.

This goes after:

- https://github.com/anoma/juvix/pull/2486
2023-10-31 18:36:34 +01:00

42 lines
761 B
Plaintext

module Simple;
type T := tt : T;
someT : T := tt;
type Bool :=
| false : Bool
| true : Bool;
type Nat :=
| zero : Nat
| suc : Nat → Nat;
syntax fixity cmp := binary;
syntax fixity add := binary {assoc := left; above := [cmp]};
syntax fixity cons := binary {assoc := right; above := [add]};
syntax operator == cmp;
== : Nat → Nat → Bool
| zero zero := true
| (suc a) (suc b) := a == b
| _ _ := false;
syntax operator + add;
+ : Nat → Nat → Nat
| zero b := b
| (suc a) b := suc (a + b);
syntax operator :: cons;
type List :=
| nil : List
| :: : Nat → List → List;
foldr : (Nat → Nat → Nat) → Nat → List → Nat
| _ v nil := v
| f v (a :: as) := f a (foldr f v as);
sum : List → Nat := foldr (+) zero;