I'm running into a weird problem recently in Andro...
# arrow
l
I'm running into a weird problem recently in Android Studio Electric Eel. All of a sudden, the
bind()
function of the
either {}
scope stops being recognized (although it just worked a few moments before and there were no changes in the code):
Copy code
Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public open suspend fun <B> Either<CallError, TypeVariable(B)>.bind(): TypeVariable(B) defined in arrow.core.continuations.EffectScope
public open suspend fun <B> Option<TypeVariable(B)>.bind(shift: () -> CallError): TypeVariable(B) defined in arrow.core.continuations.EffectScope
public open suspend fun <B> Validated<CallError, TypeVariable(B)>.bind(): TypeVariable(B) defined in arrow.core.continuations.EffectScope
public open suspend fun <B> EagerEffect<CallError, TypeVariable(B)>.bind(): TypeVariable(B) defined in arrow.core.continuations.EffectScope
public open suspend fun <B> Effect<CallError, TypeVariable(B)>.bind(): TypeVariable(B) defined in arrow.core.continuations.EffectScope
public open suspend fun <B> Result<TypeVariable(B)>.bind(transform: (Throwable) -> CallError): TypeVariable(B) defined in arrow.core.continuations.EffectScope
scenesRepository.scenes.value
is of type
Either<DataMissing, List<Scene>>
s
is
DataMissing
a subtype of
CallError
?
l
Oh yes, that might be the problem 🤦
I have a mix of functions inside the
either
scope returning different types of errors which are not related...
Thanks!
s
My pleasure Lukasz ☺️
l
I wish there was a more telling error message, but I suppose that's not easy.
s
I don't even think we can provide a custom error message for that 🤔 That would be pretty cool though! Curious if you could somehow leverage
@Deprecation
with
DeprecationLevel.ERROR
for that. Going to give that a try, that would be really awesome.
l
Also the strange thing is that it actually built before and I didn't change a single line
Maybe that's a bug in the compiler type inference
s
Curious 🤔
It's actually possible to use
@Deprecation
for this 😮
l
Wow, that's really interesting!
Feels a bit like a hack though ;)
s
If we can figure out a good error message, then we should probably leverage this in Arrow. Too bad we cannot reference the actual
E
and
R
types. Yes, it's definitely a bit of a hack but it has some cool use-cases.
l
To be precise it should say
with the same Left type or subtype
s
Going to let this sink in for a while 😄 I'd love to provide better support for Arrow in IDEA, but wish this was possible through the language rather than building an IDEA plugin.
I.e. we're planning to leverage
@DslMarker
more, and have been able to convert some comples Resource structures into simple DSLs without compromising correctness.
s
s
💪 Arrow is a community effort, combining everyones feedback has been key to what it is today. Kotlin community is really awesome 🙌