add some #[compile-scheme]

This commit is contained in:
rhiannon morris 2023-11-03 17:42:44 +01:00
parent 5dfefe443c
commit b7e1f37b5b
2 changed files with 6 additions and 0 deletions

View file

@ -24,6 +24,7 @@ def elim : 0.(A : ★) → 0.(P : (n : ) → Vec n A → ★) →
}
};
#[compile-scheme "(lambda% (n xs) xs)"]
def up : 0.(A : ★) → (n : ) → Vec n A → Vec¹ n A =
λ A n ⇒
case n return n' ⇒ Vec n' A → Vec¹ n' A of {
@ -63,6 +64,7 @@ def elim : 0.(A : ★) → 0.(P : List A → ★) →
};
-- [fixme] List A <: List¹ A should be automatic, imo
#[compile-scheme "(lambda (xs) xs)"]
def up : 0.(A : ★) → List A → List¹ A =
λ A xs ⇒
case xs return List¹ A of { (len, elems) ⇒

View file

@ -4,6 +4,7 @@ load "either.quox";
namespace nat {
#[compile-scheme "(lambda (n) (cons n 'erased))"]
def dup! : (n : ) → [ω. Sing n] =
λ n ⇒
case n return n' ⇒ [ω. Sing n'] of {
@ -16,6 +17,7 @@ def dup! : (n : ) → [ω. Sing n] =
def dup : → [ω.] =
λ n ⇒ appω (Sing n) (sing.val n) (dup! n);
#[compile-scheme "(lambda% (m n) (+ m n))"]
def plus : =
λ m n ⇒
case m return of {
@ -23,6 +25,7 @@ def plus : =
succ _, 1.p ⇒ succ p
};
#[compile-scheme "(lambda% (m n) (* m n))"]
def timesω : → ω. =
λ m n ⇒
case m return of {
@ -67,6 +70,7 @@ def0 not-succ-self : (m : ) → Not (m ≡ succ m : ) =
}
#[compile-scheme "(lambda% (m n) (if (= m n) Yes No))"]
def eq? : DecEq =
λ m ⇒
caseω m