Disclaimer: I cannot help but bring my had habits from OO into programming in Unison. If there’s a better way to do this, please let me know
When working through a function — when I don’t have access to a debugger — I have the tendency to put print statements to infer into state as the function executes. In Unison, i stumbled upon Debug.tap
which does exactly what puts
in Ruby would do.
However, when I make a change to scratch.u
without changing the trace text in Debug.tap
, the trace message does not re-print. Looks like the smart caching is thinking “Function signature is the same anyways, why not just print out the output from the cached result?” Issue here is, in my flow — which may not be optimal — the output from Debug.tap
is part of the output I’m looking for in UCM.
Is there a better way to infer state when debugging Unison functions? Is there a way to make the Debug.tap
statement always print out the trace whenever I scratch.u
something new?
Thanks!