Replies: 2 comments 1 reply
-
|
There is a generic show that shows a byte like / low level representation of any value. Not sure if it needs updating or what it looks like since I've never used it. Probably would look the best in JavaScript if you are only using functions that are also supported there. Line 67 in 4a3a197 |
Beta Was this translation helpful? Give feedback.
-
|
This issue exists in other languages with typeclasses (aka. traits) and you just deal with it basically (i.e. pass the function around, or add the typeclass constraint to all the callers and the function). There's no solution that's convenient. I suspect this may also be one of the reasons why OOP langs have One hacky solution that comes to mind is: if the language supports runtime type tests and casts, and you know the concrete types in the polymorphic code, you can do the type cast and use the concrete type's |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If you want to debug something by printing to the console, the function
trace-showcan be quite helpful.However, I find that it often does not have the
showfunction in scope (because it's not used in the actual logic, so it's not passed as implicit argument). So that requires you to temporarily modify a whole bunch of function signatures to include theshowfunction, which is not very ergonomic for debugging.Is there some dirty way to not have to do that or make it more ergonomic somehow?
EDIT: let me clarify with an example
Invoking an explicit show implementation doesn't work either, because the data is polymorphic
Beta Was this translation helpful? Give feedback.
All reactions