jean
04/20/2023, 9:28 AMbind
inside either { ... }
I’m getting this message
‘bind(): A’ is deprecated. This object introduces dangerous behavior.What am I suppose to use now? I see there is
ensure
but I don’t really understand how to use it properlymitch
04/20/2023, 9:41 AMmitch
04/20/2023, 9:42 AMraulraja
04/20/2023, 9:45 AMbind
should not be deprecated https://github.com/arrow-kt/arrow/blob/8fef14bb1ba891d909b61ab87b1865d3e8e7899d/ar[…]core/arrow-core/src/commonMain/kotlin/arrow/core/raise/Raise.kt
if you are using the right import arrow.core.raise.either
simon.vergauwen
04/20/2023, 9:56 AMarrow.core.continuations.result.bind
or something like that.
I think you're trying to bind Either<Throwable, A>
within either<E, A>
where E != Throwable
this was an old issue with a visibility issue.
So I think it's missing a mapLeft
somewhere after a Either.catch
. Is that possible?jean
04/20/2023, 10:27 AMimport arrow.core.computations.ResultEffect.bind
where it was saying “‘ResultEffect’ is deprecated. ResultEffect is replaced with arrow.core.raise.ResultRaise” and the IDE suggested to replace ResultEffect
with ResultRaise
. But that gave me a “Cannot import ‘bind’, functions and properties can be imported only from packages or objects”jean
04/20/2023, 10:27 AMThrowable
I don’t get the bind deprecation error anymoremitch
04/20/2023, 10:34 AMeither { }
? should be the one from arrow.core.raise.either
as Raul mentioned. The bind extension function will appear within the context scope.
either {
myDataFactory().bind()
}
jean
04/20/2023, 10:43 AMmapLeft
after my either
, thanks for the help!simon.vergauwen
04/20/2023, 10:43 AMThrowable -> E
missing using mapLeft
to your sealed class.
It was unsafe behavior that leaked into 1.0.0
IIRC, and was deprecated in 1.1.x
and marked as ERROR
in 1.2.x
IIRC