Is there an easy way for me to tell the compiler that everything implements inspect. I want to add a debug statement inDict
code, but can't easily do so due to the compiler thinking that k
and v
don't implement inspect. Clearly k
and v
have to implement inspect cause everything in roc implements inspect. It would be nice to just stop all type checking when it comes to inspect and never have to write where x implements Inspect
.
I don't know if it would work, but you could try making a Vis a : a where a implements Inspect
type alias and wrap stuff in it
You can also write stuff using dbg, and add type annotations afterwards
Otherwise, not a thing AFAICT
we discussed this originally but if I remember right @Ayaz Hafiz preferred having the constraint. I don't remember the exact discission anymore :big_smile:
This issue is that there are a ton of function in dict. So either I need to add the constraint or comment out the type for every single function (turns out I also need to comment out all the types in set for this to work)
I can't do it to a single function cause they are all linked by dict
And by interconnected tests and calls
So I would really like to remove the constraint in general. It is a pain in practice and would be worse for larger libraries
Being able to drop in a dbg
without changing an entire call stack is pretty fundamental
yes, it should be sufficient to add the exception to the Rigid* cases here
https://github.com/roc-lang/roc/blob/0be7b3f7501501f6ced1648f9c2644560d338505/crates/compiler/solve/src/ability.rs#L681-L703
Note that you'll need to promote the var to include the ability in the same way is done for FlexVar
otherwise the derived impl will never be created (I think)
Last updated: Jul 06 2025 at 12:14 UTC