Is there a way to see what the type of something is in roc repl or binary when using dbg?
dbg "hello" outputs value and type? "hello" : Str?
Use :t
$ roc repl
The rockin' roc repl
────────────────────────
Enter an expression, or :help, or :q to quit.
» x = 2
assigned `x`
» :t x
x : Dec
That is very helpful, but what about outside roc repl? I sometimes want to see the type in a debug statement from within a compiled roc program. For example, what is the type for echo! which is not exposed in roc repl?
what about lsp?
I think adding types to dbg would really clutter up its output, which would make it worse at its primary purpose
oh, also if you want to make a code change that results in your seeing the type of something, an old trick is to just add a type annotation you know is incorrect - e.g. main! : {} and then the type mismatch will tell you what the compiler thinks its type is :smile:
Forcing a compile error will work, although a bit hacky :joy:. Thank you @Richard Feldman @Luke Boswell!!
Last updated: Sep 24 2026 at 15:59 UTC