mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 03:45:29 +03:00
13 lines
387 B
Plaintext
13 lines
387 B
Plaintext
# This will only work if we make the call to `(Result/foo a b)` lazy (by converting it to a combinator).
|
|
Result/bind = @val @nxt match val {
|
|
Result/Ok: ((undefer nxt) val.val)
|
|
Result/Err: (Result/Err val.val)
|
|
}
|
|
Result/foo x y =
|
|
with Result {
|
|
ask a = (Result/Ok x)
|
|
ask b = switch y { 0: (Result/Err a); _: (Result/Ok y-1) }
|
|
(Result/foo a b)
|
|
}
|
|
|
|
main = (Result/foo 1 2) |