Print less debug information by default
maxsnew opened this issue · 2 comments
maxsnew commented
Currently, when you run zydeco-lang run zydeco/interp.zydeco
it prints out:
=== [interpreter.zydeco] <parse>
let lookup = { rec (lookup) -> fn (x) -> fn (g) -> match g
| Empty() -> ret Err()
| Cons(y, v, g) -> do b <- !str_eq x y;
if b: ret Ok(v) else: !lookup x g };
let error = { rec (error) -> comatch
.app(_) -> !error
.bind() -> ret Err() };
let interp = { rec (interp) -> comatch
.valu(v, g) -> match v
| Var(x) -> !lookup x g
| True() -> ret Ok(True'())
| False() -> ret Ok(False'())
| ThunkV(m) -> ret Ok(ThunkV'({ !interp.comp(m, g) }))
.comp(m, g) -> match m
| If(cond, mt, mf) -> match cond
| True() -> !interp.comp(mt, g)
| False() -> !interp.comp(mf, g)
| Force(syn_val) -> do v? <- !interp.valu(syn_val, g);
match v?
| Ok(v) -> match v
| ThunkV'(t) -> !t
| True'() -> !error
| False'() -> !error
| Err() -> !error
| Return(syn_val) -> do v <- !interp.valu(syn_val, g);
comatch
.bind() -> ret v
.app(_) -> !error
| Bind(m, x, k) -> do v? <- !interp.comp(m, g).bind();
match v?
| Ok(v) -> !interp.comp(k, Cons(x,v,g))
| Err() -> !error
| Lam(x, m) -> comatch
.app(v) -> !interp.comp(m, Cons(x,v,g))
.bind() -> ret Err()
| App(m, v) -> do v? <- !interp.valu(v, g);
match v?
| Ok(v) -> !interp.comp(m, g).app(v)
| Err() -> !error };
!interp.comp(App(Lam("x",Return(Var("x"))),False()), Empty()).bind()
=== [interpreter.zydeco] <check>
Ret(OptionSemVal)
=== [interpreter.zydeco] <elab>
Let { binding: (VVar("lookup", ()), Thunk(Rec { arg: VVar("lookup", ()), body: Lam { arg: VVar("x", ()), body: Lam { arg: VVar("g", ()), body: Match { scrut: Var(VVar("g", ()), ()), cases: [(Ctor("Empty", ()), [], Return(Ctor(Ctor("Err", ()), [], ()), ())), (Ctor("Cons", ()), [VVar("y", ()), VVar("v", ()), VVar("g", ())], Do { binding: (VVar("b", ()), App(App(Force(Var(VVar("str_eq", ()), ()), ()), Var(VVar("x", ()), ()), ()), Var(VVar("y", ()), ()), ())), body: If { cond: Var(VVar("b", ()), ()), thn: Return(Ctor(Ctor("Ok", ()), [Var(VVar("v", ()), ())], ()), ()), els: App(App(Force(Var(VVar("lookup", ()), ()), ()), Var(VVar("x", ()), ()), ()), Var(VVar("g", ()), ()), ()), ann: () }, ann: () })], ann: () }, ann: () }, ann: () }, ann: () }, None, ())), body: Let { binding: (VVar("error", ()), Thunk(Rec { arg: VVar("error", ()), body: CoMatch { cases: [(Dtor("app", ()), [VVar("_", ())], Force(Var(VVar("error", ()), ()), ())), (Dtor("bind", ()), [], Return(Ctor(Ctor("Err", ()), [], ()), ()))], ann: () }, ann: () }, None, ())), body: Let { binding: (VVar("interp", ()), Thunk(Rec { arg: VVar("interp", ()), body: CoMatch { cases: [(Dtor("valu", ()), [VVar("v", ()), VVar("g", ())], Match { scrut: Var(VVar("v", ()), ()), cases: [(Ctor("Var", ()), [VVar("x", ())], App(App(Force(Var(VVar("lookup", ()), ()), ()), Var(VVar("x", ()), ()), ()), Var(VVar("g", ()), ()), ())), (Ctor("True", ()), [], Return(Ctor(Ctor("Ok", ()), [Ctor(Ctor("True'", ()), [], ())], ()), ())), (Ctor("False", ()), [], Return(Ctor(Ctor("Ok", ()), [Ctor(Ctor("False'", ()), [], ())], ()), ())), (Ctor("ThunkV", ()), [VVar("m", ())], Return(Ctor(Ctor("Ok", ()), [Ctor(Ctor("ThunkV'", ()), [Thunk(CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("comp", ()), args: [Var(VVar("m", ()), ()), Var(VVar("g", ()), ())], ann: () }, None, ())], ())], ()), ()))], ann: () }), (Dtor("comp", ()), [VVar("m", ()), VVar("g", ())], Match { scrut: Var(VVar("m", ()), ()), cases: [(Ctor("If", ()), [VVar("cond", ()), VVar("mt", ()), VVar("mf", ())], Match { scrut: Var(VVar("cond", ()), ()), cases: [(Ctor("True", ()), [], CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("comp", ()), args: [Var(VVar("mt", ()), ()), Var(VVar("g", ()), ())], ann: () }), (Ctor("False", ()), [], CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("comp", ()), args: [Var(VVar("mf", ()), ()), Var(VVar("g", ()), ())], ann: () })], ann: () }), (Ctor("Force", ()), [VVar("syn_val", ())], Do { binding: (VVar("v?", ()), CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("valu", ()), args: [Var(VVar("syn_val", ()), ()), Var(VVar("g", ()), ())], ann: () }), body: Match { scrut: Var(VVar("v?", ()), ()), cases: [(Ctor("Ok", ()), [VVar("v", ())], Match { scrut: Var(VVar("v", ()), ()), cases: [(Ctor("ThunkV'", ()), [VVar("t", ())], Force(Var(VVar("t", ()), ()), ())), (Ctor("True'", ()), [], Force(Var(VVar("error", ()), ()), ())), (Ctor("False'", ()), [], Force(Var(VVar("error", ()), ()), ()))], ann: () }), (Ctor("Err", ()), [], Force(Var(VVar("error", ()), ()), ()))], ann: () }, ann: () }), (Ctor("Return", ()), [VVar("syn_val", ())], Do { binding: (VVar("v", ()), CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("valu", ()), args: [Var(VVar("syn_val", ()), ()), Var(VVar("g", ()), ())], ann: () }), body: CoMatch { cases: [(Dtor("bind", ()), [], Return(Var(VVar("v", ()), ()), ())), (Dtor("app", ()), [VVar("_", ())], Force(Var(VVar("error", ()), ()), ()))], ann: () }, ann: () }), (Ctor("Bind", ()), [VVar("m", ()), VVar("x", ()), VVar("k", ())], Do { binding: (VVar("v?", ()), CoApp { scrut: CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("comp", ()), args: [Var(VVar("m", ()), ()), Var(VVar("g", ()), ())], ann: () }, dtor: Dtor("bind", ()), args: [], ann: () }), body: Match { scrut: Var(VVar("v?", ()), ()), cases: [(Ctor("Ok", ()), [VVar("v", ())], CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("comp", ()), args: [Var(VVar("k", ()), ()), Ctor(Ctor("Cons", ()), [Var(VVar("x", ()), ()), Var(VVar("v", ()), ()), Var(VVar("g", ()), ())], ())], ann: () }), (Ctor("Err", ()), [], Force(Var(VVar("error", ()), ()), ()))], ann: () }, ann: () }), (Ctor("Lam", ()), [VVar("x", ()), VVar("m", ())], CoMatch { cases: [(Dtor("app", ()), [VVar("v", ())], CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("comp", ()), args: [Var(VVar("m", ()), ()), Ctor(Ctor("Cons", ()), [Var(VVar("x", ()), ()), Var(VVar("v", ()), ()), Var(VVar("g", ()), ())], ())], ann: () }), (Dtor("bind", ()), [], Return(Ctor(Ctor("Err", ()), [], ()), ()))], ann: () }), (Ctor("App", ()), [VVar("m", ()), VVar("v", ())], Do { binding: (VVar("v?", ()), CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("valu", ()), args: [Var(VVar("v", ()), ()), Var(VVar("g", ()), ())], ann: () }), body: Match { scrut: Var(VVar("v?", ()), ()), cases: [(Ctor("Ok", ()), [VVar("v", ())], CoApp { scrut: CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("comp", ()), args: [Var(VVar("m", ()), ()), Var(VVar("g", ()), ())], ann: () }, dtor: Dtor("app", ()), args: [Var(VVar("v", ()), ())], ann: () }), (Ctor("Err", ()), [], Force(Var(VVar("error", ()), ()), ()))], ann: () }, ann: () })], ann: () })], ann: () }, ann: () }, None, ())), body: CoApp { scrut: CoApp { scrut: Force(Var(VVar("interp", ()), ()), ()), dtor: Dtor("comp", ()), args: [Ctor(Ctor("App", ()), [Ctor(Ctor("Lam", ()), [String("x", ()), Ctor(Ctor("Return", ()), [Ctor(Ctor("Var", ()), [String("x", ())], ())], ())], ()), Ctor(Ctor("False", ()), [], ())], ()), Ctor(Ctor("Empty", ()), [], ())], ann: () }, dtor: Dtor("bind", ()), args: [], ann: () }, ann: () }, ann: () }, ann: () }
=== [interpreter.zydeco] <eval>
Ctor(Ctor("Ok", ()), [Ctor(Ctor("False'", ()), [], ())], ())
This is way too much. If you really want it all it should be behind a --debug
flag.
By default it should just print:
Ok(false)
Which is the output of the program.
LighghtEeloo commented
Addressed in da843a1.
LighghtEeloo commented
The problem of reporting too little error is addressed in 26c4602. Now we can expect some reasonable output in terms of verbosity. For full output, pass in --verbose
.