Kind/book/Parser.pick_while.go.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

22 lines
764 B
Plaintext

Parser.pick_while.go
: ∀(cond: ∀(chr: Char) Bool) (Parser String)
= λcond λcode
use P = λx (Parser.Result String)
use cons = λhead λtail
use P = λx
∀(head: Char) ∀(tail: String) (Parser.Result String)
use true = λhead λtail
use P = λx (Parser.Result String)
use done = λcode λvalue
(Parser.Result.done String code (String.cons head value))
use fail = λerror (Parser.Result.fail String error)
(~(Parser.pick_while.go cond tail) P done fail)
use false = λhead λtail
(Parser.Result.done
String
(String.cons head tail)
String.nil
)
(~(cond head) P true false head tail)
use nil = (Parser.Result.done String String.nil String.nil)
(~code P cons nil)