S.
06/11/2025, 3:04 PMeither {}
in combination with flow {}
? when I have a function like this
fun list(): Either<Error, Flow<Item>> = either {
flow {
if (someSuspendFun()) this@either.raise(Error)
emitAll(someList())
}
}
it says arrow.core.raise.RaiseLeakedException: 'raise' or 'bind' was leaked outside of its context scope. Make sure all calls to 'raise' and 'bind' occur within the lifecycle of nullable { }, either { } or similar builders.
or is the way to go to make the function suspend and do the check before the flow block?simon.vergauwen
06/11/2025, 3:18 PMFlow<Either<E, A>>
, or you need to call collect inside either
itself.S.
06/11/2025, 3:21 PMsuspend fun list(): Either<Error, Flow<Item>> = either {
if (someSuspendFun()) raise(Error)
someList()
}
or is Either<E, Flow<A>>
a bad idea in general?simon.vergauwen
06/11/2025, 3:22 PMS.
06/11/2025, 3:23 PM