Kind/book/IO.bind.kind2
Victor Taelin 85ad65b026 use-notation
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.
2024-03-08 17:39:37 -03:00

21 lines
506 B
Plaintext

IO.bind
: ∀(A: *)
∀(B: *)
∀(a: (IO A))
∀(b: ∀(x: A) (IO B))
(IO B)
= λA λB λa λb
use P = λx ∀(b: ∀(x: A) (IO B)) (IO B)
use print = λtext λthen λb
(IO.print B text λx (IO.bind A B (then x) b))
use load = λfile λthen λb
(IO.load B file λs (IO.bind A B (then s) b))
use save = λfile λdata λthen λb
(IO.save
B
file
data
λx (IO.bind A B (then Unit.one) b)
)
use done = λterm λb (b term)
(~a P print load save done b)