mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-10-26 16:20:58 +03:00
85ad65b026
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.ref
|
|
: ∀(term: Kind.Term)
|
|
∀(P: *)
|
|
∀(Y: ∀(nam: String) ∀(val: Kind.Term) P)
|
|
∀(N: ∀(val: Kind.Term) P)
|
|
P
|
|
= λterm λP λY λN
|
|
use P = λx
|
|
∀(Y: ∀(nam: String) ∀(val: 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 (Y 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 (N (Kind.hol 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
|
|
) |