about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'users/tazjin/rlox/src/main.rs')
-rw-r--r--users/tazjin/rlox/src/main.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/users/tazjin/rlox/src/main.rs b/users/tazjin/rlox/src/main.rs
index 2b4e365d41..2d8cf4f354 100644
--- a/users/tazjin/rlox/src/main.rs
+++ b/users/tazjin/rlox/src/main.rs
@@ -11,7 +11,7 @@ mod treewalk;
 /// Trait for making the different interpreters callable in the same
 /// way.
 pub trait Lox {
-    type Value;
+    type Value: std::fmt::Debug;
     type Error: std::fmt::Display;
 
     fn create() -> Self;
@@ -69,9 +69,12 @@ fn run_prompt<I: Lox>() {
 }
 
 fn run<I: Lox>(lox: &mut I, code: String) {
-    if let Err(errors) = lox.interpret(code) {
-        for error in errors {
-            eprintln!("{}", error);
+    match lox.interpret(code) {
+        Ok(result) => println!("=> {:?}", result),
+        Err(errors) => {
+            for error in errors {
+                eprintln!("{}", error);
+            }
         }
     }
 }