Update combinators test and improve docs

This commit is contained in:
imaqtkatt 2024-03-28 19:10:49 -03:00
parent 37fdd38d7b
commit 30d7888d23
3 changed files with 10 additions and 3 deletions

View File

@ -15,7 +15,8 @@ impl Book {
///
/// The floating algorithm follows these rules:
/// - Recursively float every child term.
/// - Extract if it is a combinator and not is a safe term.
/// - Extract if it is a combinator and is not a safe term.
/// See [`Term::is_safe`] for what is considered safe here.
pub fn float_combinators(&mut self) {
let mut combinators = Combinators::new();

View File

@ -12,12 +12,14 @@
(qux) = {0 qux}
(clax) = (λx x λa λb λc λd (clax d))
(tup) = (tup, 1, 0)
(list) = [0 list]
(A x) = (let {a b} = A; @c (a b c) x)
(A x) = (let {a b} = A; λc (a b c) x)
(B x) = (let (a, b) = B; @c (a b c) x)
(B x) = (let (a, b) = B; λc (a b c) x)
(Main) = list

View File

@ -12,6 +12,8 @@ input_file: tests/golden_tests/desugar_file/combinators.hvm
(qux) = {0 qux}
(clax) = (λa a clax$C0)
(tup) = (tup, 1, 0)
(list) = (List.cons 0 list$C0)
@ -32,4 +34,6 @@ input_file: tests/golden_tests/desugar_file/combinators.hvm
(List.ignore$C0) = #List λ* #List λd (List.ignore d List.ignore)
(clax$C0) = λ* λ* λ* λe (clax e)
(list$C0) = (List.cons list List.nil)