CLOVIS
10/31/2022, 11:33 AMEffectScope<Failure>.() -> Unit
or:
() -> Either<Failure, Unit>
I think the first one is clearer that "it's just validation code", what do you think? Is there any official recommendation?
The first one also doesn't need the user to call bind
, which they may forget since there is no proper result.simon.vergauwen
10/31/2022, 3:23 PMcontext(EffectScope<Failure>)
suspend fun validate(): Unit = TODO()
With Arrow 2.x.x suspend
will become optional, depending on whether you use suspend inside or not.
context(Raise<Failure>)
(suspend) fun validate(): Unit = TODO()
In Arrow 2.x.x you’ll be able to do either { validate() }
to turn it into () -> Either<Failure, Unit>
. Where in Arrow 1.x.x you still need to be explicit about either.eager
and EagerEffectScope<Failure>
.
I expect Arrow 2.x.x to become stable sooner than context receivers since they’re still JVM experimental atm.
You can now use extension functions instead of context receivers