Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove expand in debug hook #234

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,11 +261,10 @@ pub fn run_compiled(
let start_time = Instant::now();

if let Some(mut hook) = hook {
root.expand();
while !root.redexes.is_empty() {
hook(&host.lock().unwrap().readback(root));
let readback = host.lock().unwrap().readback(root);
hook(&readback);
root.reduce(1);
root.expand();
}
} else if let Some(mut max_rwts) = max_rwts {
if run_opts.lazy_mode {
Expand Down
4 changes: 4 additions & 0 deletions tests/golden_tests/cli/debug_u60_to_nat.args
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
run
tests/golden_tests/cli/debug_u60_to_nat.hvm
-d
4
6 changes: 6 additions & 0 deletions tests/golden_tests/cli/debug_u60_to_nat.hvm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data Nat = (Z) | (S nat)

(U60ToNat 0) = Z
(U60ToNat 1+p) = (S (U60ToNat p))

(Main n) = (U60ToNat n)
33 changes: 33 additions & 0 deletions tests/snapshots/cli__debug_u60_to_nat.hvm.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
source: tests/golden_tests.rs
input_file: tests/golden_tests/cli/debug_u60_to_nat.hvm
---
a (U60ToNat a) 4)
---------------------------------------
(U60ToNat 4)
---------------------------------------
a (S (U60ToNat a)) 3)
---------------------------------------
(S (U60ToNat 3))
---------------------------------------
(Sa (S (U60ToNat a)) 2))
---------------------------------------
(S (S (U60ToNat 2)))
---------------------------------------
(S (Sa (S (U60ToNat a)) 1)))
---------------------------------------
(S (S (S (U60ToNat 1))))
---------------------------------------
(S (S (Sa (S (U60ToNat a)) 0))))
---------------------------------------
(S (S (S (S (U60ToNat 0)))))
---------------------------------------
(S (S (S (S Z))))
---------------------------------------
(S (S (S #Nat λ* #Nat λa #Nat (a Z))))
---------------------------------------
(S (S #Nat λ* #Nat λa #Nat (a #Nat λ* #Nat λb #Nat (b Z))))
---------------------------------------
(S #Nat λ* #Nat λa #Nat (a #Nat λ* #Nat λb #Nat (b #Nat λ* #Nat λc #Nat (c Z))))
---------------------------------------
(S (S (S (S Z))))
Loading