mirror of
https://github.com/anoma/juvix.git
synced 2024-12-04 06:23:13 +03:00
83539148cb
* Closes #3079 * Closes #3086 * Depends on #3088 * Updates the coding style guidelines (CODING.md) to reflect issues not foreseen originally * Changes the unicode arrow printed in the REPL to `->`. This is to make the output consistent with how function types are written in the standard library. --------- Co-authored-by: Paul Cadman <git@paulcadman.dev>
34 lines
739 B
Plaintext
34 lines
739 B
Plaintext
-- dependent lambda-abstractions
|
|
|
|
def fun :
|
|
Π A : Type,
|
|
A -> A :=
|
|
λ(A : Type)
|
|
λ(x : A)
|
|
let f : (A -> A) -> A := λ(h : A -> A) h (h x) in
|
|
f (λ(y : A) x);
|
|
|
|
def helper : Int -> Int -> Int :=
|
|
λ(a : Int)
|
|
λ(b : Int)
|
|
a * b - b;
|
|
|
|
def fun' : Π T : Type -> Type,
|
|
Π unused : Type,
|
|
Π C : Type,
|
|
Π A : Type,
|
|
(T A -> A -> C)
|
|
-> A
|
|
-> C :=
|
|
λ(T : Type -> Type)
|
|
λ(unused : Type)
|
|
λ(C : Type)
|
|
λ(A : Type)
|
|
λ(mhelper : T A -> A -> C)
|
|
λ(a' : A)
|
|
let f : (A -> A) -> A := λ(g : A -> A) g (g a') in
|
|
let h : A -> A -> C := λ(a1 : A) λ(a2 : A) mhelper a2 a1 in
|
|
f (λ(y : A) h y a');
|
|
|
|
fun Int 2 + fun' (λ(A : Type) A) Bool Int Int helper 3
|