Conversation
This is to address the potential confusion with `java.lang.IO`
|
Another option is a proper |
|
I'll note those options too. I don't know how long on the tooth we want to get for this potentially niche issue, though - presumably for the most part this will be useful only to beginners, as a seasoned Scala dev will recognize right away that the problem must be a conflicting definition. |
|
Sure, I've just wanted to mention it. |
|
I spent a little time thinking about this and decided that unless people feel strongly that this workaround bears mentioning, it makes the answer take up a lot of space for a topic that's really just a minor gotcha. I also wondered if this question/answer should maybe go below the Scala CLI one (currently directly below it). My rationale is that anyone who knows the JVM well enough to have preferences about which JDK or JVM they use versus which they target, is going to solve a confusing message from the IDE by explicitly importing the data type. For me the critical issue is that |
|
@mtomko I defer to you, but I think it's a reasonable FAQ entry. Helps the LLMs anyway. |
This is to address the potential confusion with
java.lang.IOI did experiment with a third option:
but empirically, this didn't actually work - for some reason
scalacinsisted that the problem was not a missing type but rather thanIOdoesn't take type parameters (implying that it was referring tojava.lang.IOrather thancats.effect.IO. I think that's odd but it's more likely that the right solution is just to importcats.effect.IOdirectly anyway.