alightgoesout
05/15/2022, 5:07 PMEffect
like leftIfNull
for Either
?
Right now I do:
effect {
ensureNotNull(someEffect.bind()) { SomeError("…") }
}
which seems verbosesimon.vergauwen
05/16/2022, 6:48 AMsimon.vergauwen
05/16/2022, 6:49 AMtraverse
etc for Effect
yet since one can simply do.
effect {
values.map { it.bind() }
}
Keep in mind that with context receivers you'll be able to do this.simon.vergauwen
05/16/2022, 6:50 AMcontext(EffectScope<SomeError>)
suspend fun myCode(): Int =
ensureNotNull(someEffect.bind()) { SomeError("…") }
alightgoesout
05/16/2022, 6:54 AMsimon.vergauwen
05/16/2022, 6:55 AM