mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 17:56:48 +03:00
Now, there are two local binders: let x = ... use x = ... The 'let' binder will create a local definition, type-check it, and assign a name to it. When compiled, it will create 'dup' nodes. The 'use' binder is just an alias. It will not bind a new variable, and, when compiled, will create inline copies. Also, for type-checking, it allows creating aliases that are definitionaly equal for the checker.
48 lines
1.2 KiB
Plaintext
48 lines
1.2 KiB
Plaintext
Kind.if.hol
|
|
: ∀(term: Kind.Term)
|
|
∀(P: *)
|
|
∀(Y: ∀(nam: String) ∀(ctx: (List Kind.Term)) P)
|
|
∀(N: ∀(val: Kind.Term) P)
|
|
P
|
|
= λterm λP λY λN
|
|
use P = λx
|
|
∀(Y: ∀(nam: String) ∀(ctx: (List Kind.Term)) P)
|
|
∀(N: ∀(val: Kind.Term) P)
|
|
P
|
|
use all = λnam λinp λbod λY λN (N (Kind.all nam inp bod))
|
|
use lam = λnam λbod λY λN (N (Kind.lam nam bod))
|
|
use app = λfun λarg λY λN (N (Kind.app fun arg))
|
|
use ann = λval λtyp λY λN (N (Kind.ann val typ))
|
|
use slf = λnam λbod λY λN (N (Kind.slf nam bod))
|
|
use ins = λval λY λN (N (Kind.ins val))
|
|
use ref = λnam λval λY λN (N (Kind.ref nam val))
|
|
use def = λnam λval λbod λY λN (N (Kind.def nam val bod))
|
|
use set = λY λN (N Kind.set)
|
|
use u60 = λY λN (N Kind.u60)
|
|
use num = λval λY λN (N (Kind.num val))
|
|
use op2 = λopr λfst λsnd λY λN (N (Kind.op2 opr fst snd))
|
|
use mat = λnam λx λz λs λp λY λN (N (Kind.mat nam x z s p))
|
|
use txt = λlit λY λN (N (Kind.txt lit))
|
|
use hol = λnam λctx λY λN (Y nam ctx)
|
|
use var = λnam λidx λY λN (N (Kind.var nam idx))
|
|
(~term
|
|
P
|
|
all
|
|
lam
|
|
app
|
|
ann
|
|
slf
|
|
ins
|
|
ref
|
|
def
|
|
set
|
|
u60
|
|
num
|
|
op2
|
|
mat
|
|
txt
|
|
hol
|
|
var
|
|
Y
|
|
N
|
|
) |