mirror of
https://github.com/HigherOrderCO/Kind.git
synced 2024-09-11 17:15:26 +03:00
13 lines
333 B
Plaintext
13 lines
333 B
Plaintext
Parser.bind
|
|
: ∀(A: *)
|
|
∀(B: *)
|
|
∀(a: (Parser A))
|
|
∀(b: ∀(x: A) (Parser B))
|
|
(Parser B)
|
|
= λA λB λa λb
|
|
λcode
|
|
let P = λx ∀(b: ∀(x: A) (Parser B)) (Parser.Result B)
|
|
let done = λa.code λa.value λb (b a.value a.code)
|
|
let fail = λa.error λb (Parser.Result.fail B a.error)
|
|
(~(a code) P done fail b)
|