I think that most difficult and confusing part of using roc language i situation when certain type was deduced for specific value in previous context, and there is error printed that value should adhere to certain type later on. That all good but compiler does not point out place when this value type was deduced in first place and sometimes it is not so easy to figure this out
That's also a problem in Elm. My solution is always to add type annotations, to tell the compiler: No that is actually what I want, tell me why you think this is something else. Though that's not always easy. I the error messages could be improved here, that would be great: "I think this a X because of how you declared it <here>, but you use it like it is an Y <here>." Or something like that.
Can you provide a code example @Artur Swiderski? That will make it easier to discuss improvements.
@Anton
g = 1u32
p = g >1.1
compiler should show me line "g = 1u32" as reference
it only shows that g is expected to be Frac and it is not but there is no line given to support that, here it is trivial and not really necessary but in many cases it is not so trivial
It is indeed a pain point, I've created an issue with proposed solutions and have asked Ayaz to weigh in.
Last updated: Jul 05 2025 at 12:14 UTC