mirror of
https://github.com/HigherOrderCO/Bend.git
synced 2024-09-11 03:45:29 +03:00
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
---
|
|
source: tests/golden_tests.rs
|
|
input_file: tests/golden_tests/desugar_file/bind_syntax.bend
|
|
---
|
|
(undefer) = λa (a λb b)
|
|
|
|
(Result/bind) = λa λb (a Result/bind__C2 b)
|
|
|
|
(safe_div) = λa λb (switch b { 0: λ* (Result/Err (String/Cons 68 (String/Cons 105 (String/Cons 118 (String/Cons 32 (String/Cons 98 (String/Cons 121 (String/Cons 32 (String/Cons 48 String/Nil))))))))); _: safe_div__C0; } a)
|
|
|
|
(safe_rem) = λa λb (switch b { 0: λ* (Result/Err (String/Cons 77 (String/Cons 111 (String/Cons 100 (String/Cons 32 (String/Cons 98 (String/Cons 121 (String/Cons 32 (String/Cons 48 String/Nil))))))))); _: safe_rem__C0; } a)
|
|
|
|
(Main) = (Result/bind (safe_div 3 2) λa (a λb (Result/bind (safe_rem b 0) λc (c λd d))))
|
|
|
|
(String/Nil) = λa (a String/Nil/tag)
|
|
|
|
(String/Cons) = λa λb λc (c String/Cons/tag a b)
|
|
|
|
(Result/Ok) = λa λb (b Result/Ok/tag a)
|
|
|
|
(Result/Err) = λa λb (b Result/Err/tag a)
|
|
|
|
(String/Nil/tag) = 0
|
|
|
|
(String/Cons/tag) = 1
|
|
|
|
(Result/Ok/tag) = 0
|
|
|
|
(Result/Err/tag) = 1
|
|
|
|
(Result/bind__C0) = λa λb (undefer b a)
|
|
|
|
(Result/bind__C1) = λ* λa λ* (Result/Err a)
|
|
|
|
(Result/bind__C2) = λa switch a { 0: Result/bind__C0; _: Result/bind__C1; }
|
|
|
|
(safe_div__C0) = λa λb (Result/Ok (/ b (+ a 1)))
|
|
|
|
(safe_rem__C0) = λa λb (Result/Ok (% b (+ a 1)))
|