You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it's not clear why Either<Throwable, Int> cannot be bind inside either<String, A> { },
and similarly with other data types that don't match the logical failure channel type.
Based on some discussions on Twitter, and Slack we discovered that you can leverage DeprecationLevel.ERROR to provide hints to the user, to clarify why the signature results in a ERROR.
We can on a per type/signature basis provide better error messages to the user. I.e.
"Option.bind() cannot be called with different error type, use mapLeft to transform None into the same error type"
"Either.bind() can only be called with the Left type, or subtype. Use mapLeft to transform the error type.
I'll take a stab at this in arrow-context, since I think contexts could make implementing this pattern a lot easier. My only fear is that collisions could happen where the inner context binds stronger to such an erroneous declaration than an outer context, but I'll test out and see if that's the case.
My only fear is that collisions could happen where the inner context binds stronger to such an erroneous declaration than an outer context, but I'll test out and see if that's the case.
Yes, that is most likely going to occur but in those case need to explicitly call implicit<OutScope>().function(), right? Perhaps clarifying in the message is enough? Ideally, this would be done with fully flexed IDEA support but looks like that won't ever happen from Kotlin plugins.
What version are you currently using?
1.x.x
What would you like to see?
Sometimes it's not clear why
Either<Throwable, Int>
cannot bebind
insideeither<String, A> { }
,and similarly with other data types that don't match the logical failure channel type.
Based on some discussions on Twitter, and Slack we discovered that you can leverage
DeprecationLevel.ERROR
to provide hints to the user, to clarify why the signature results in aERROR
.We can on a per type/signature basis provide better error messages to the user. I.e.
https://twitter.com/vergauwen_simon/status/1578047840227557379?s=20&t=REup7C6kEet76dtI66gUIQ
https://kotlinlang.slack.com/archives/C5UPMM0A0/p1665068590923969
The text was updated successfully, but these errors were encountered: