mirror of
https://github.com/anoma/juvix.git
synced 2024-11-30 14:13:27 +03:00
98b1daec7d
Print JuvixCore InfoTable in such a way that it can be parsed back by the JuvixCore parser. * Depends on PR #1832 * Depends on PR #1862 * Closes #1841 * Adds "JuvixCore print" tests which read the files from Core/positive/*.jvc, print them, read them back and check if the evaluation results are preserved. --------- Co-authored-by: Jan Mas Rovira <janmasrovira@gmail.com>
27 lines
791 B
Plaintext
27 lines
791 B
Plaintext
-- type application and abstraction
|
|
|
|
type list : Π A : Type, Type {
|
|
cons : Π A : Type, A → list A → list A;
|
|
nil : Π A : Type, list A;
|
|
};
|
|
|
|
def id : Π A : Type, A → A := λ(A : Type) λ(x : A) x;
|
|
|
|
def hd : Π A : Type, list A → A := λ(A : Type) λl case l of { cons _ x _ := x };
|
|
|
|
def tl : Π A : Type, list A → list A := λ(A : Type) λl case l of { cons _ _ y := y };
|
|
|
|
def f := λ(A : Type) λ(x : A) λ(B : Type) λ(y : B) x + y;
|
|
|
|
def g := λ(A : Type) λ(xs : list A) λ(B : Type) λ(ys : list B) case xs of {
|
|
cons A' x _ := case ys of {
|
|
cons B' y _ := f A' x B' y;
|
|
nil _ := x;
|
|
};
|
|
nil _ := 0;
|
|
};
|
|
|
|
def main := g Int (cons Int 2 (nil Int)) Int (cons Int 3 (nil Int)) * f Int 1 Int (hd Int (tl Int (id (list Int) (cons Int 1 (cons Int 2 (nil Int))))));
|
|
|
|
main
|